I have a Chrome app that opens a popup window. I would like it to be able to stay on top, but am currently unable to do so.
The Chat for Google extension opens a popup window that not only stays on top of all windows, but the window itself also appears to have a completely customized appearance. Unfortunately, all the JavaScript in this extension is obfuscated, and I can't make heads or tails of it.
The Chrome API lists the "alwaysOnTop" boolean as part of the Window type, but neither the create nor the update functions allow for changing this property.
It’s a panel type of window. Call chrome.windows.create with a type: 'panel' parameter. This currently only works in the dev and canary channels.
Related
I noticed that the 1password chrome extension browser action popup is draggable. How can I make my own chrome extension do the same thing? I can't seem to find anything in the chrome extension docs.
A few other features the 1password chrome extension popup has that I also can't find in the docs.
When the 1password popup appears, there's a little triangle at the top of the popup which appears where my cursor is. How does this happen? As far as I'm aware, then html document I associate with the popup is displayed as a rectangle without the triangle.
I can't right-click on the body of the 1password popup to inspect javascript. Could this be because they overrode the default contextMenu behavior?
The standard popup window cannot be dragged, neither you can add anything outside of its borders. It's a popup page declared via browser_action or page_action in manifest.json.
The workarounds are:
open a separate window using chrome.windows.create,
specify the type parameter as 'popup'
create a DOM element inside the web page using a content script,
see also How to really isolate stylesheets in the Google Chrome extension?
The element can be draggable.
To inspect pages that block the context menu you can open devtools from the browser menu, then "More tools", or focus the address bar first, then press the hotkey to open devtools (CtrlShifti or F12 in Windows) or from the internal UI page chrome://inspect/#pages.
P.S. technically you can write an external utility and run it via nativeMessaging so it'll use a low-level OS API to move the standard popup window, but that's very fragile.
I am writing a Google Chrome extension for managing tabs (inspired by Tabs Outliner, which Chrome 60 broke). I have a popup window showing previously-closed browser windows and their tabs:
When I click on "Saved window", the event handler calls
chrome.windows.create(
{
url: urls, // Array of the URLs of the tabs, here ['https://demozoo.org']
focused: true
},
function(win) {
// callback code omitted
}
);
That works, but the resulting window is the same size as the popup, not the same size as a normal browser window would be if I hit Ctrl+N. How can I create the window at the Ctrl+N size instead?
Some workarounds:
Edit as suggested by wOxxOm, if there is a window open, I can use chrome.windows.get() to get its size and position, then create at that size. However, I am looking for a solution that will work even when there is no window open other than my popup itself. In that situation, chrome.windows.getAll() returns only the popup. However, the size of the last-closed (non-popup?) window is saved somewhere, because Ctrl+N in my popup window will open a window at that size, not the popup's size.
Edit 2 as suggested by Mayken, I can track the size of the most recently closed window manually, by trapping all chrome.windows onRemoved events. (I would also have to track onCreated for, e.g., just after Chrome startup, before any window has been closed.) However, since Chrome already tracks this, I am wondering if I can read Chrome's value rather than duplicating effort.
Original If I inspect the popup, in the console, I can run
chrome.windows.create()
and get a window that is the same size as the normal window. However, if I provide any URL, e.g.:
chrome.windows.create({url:'about:blank'})
the window has the size of the parent popup. As a workaround, I can use chrome.windows.create() and then manually add the tabs one at a time with chrome.tabs.create(). However, I would like to keep the convenience of the urls: [...] parameter if possible.
Alternatively, I could create an empty window with chrome.windows.create(), get its size, close it, and then open the new window with the specified size. I am not a big fan of the risk of flicker, though.
I have looked online and can't find a way to access the default size or create a window with urls at the default size. The information is in the profile's Preferences file per this answer, but I can't find a reliable, cross-platform way to build a file:// URL to the profile directory. I also cannot find an API in the list that looks like it provides profile information.
Is it possible to remove all "chrome" from a browser window, without going full-screen (with or without CSS/js) Ala Quicktime modal?
So all you see is the content and the drop shadows no toolbars, not even the close/minimise/minimise toolbar.
No, it isn't.
You can open a new window with some chrome removed using the strWindowFeatures features of open, but you've never been able to remove the title bar and more features set to Always On by browsers as an anti-phishing measure.
You could get something similar to what you are asking for by just using an iframe in an existing page. Obviously, it won't be free floating.
I am working in vb.net 2005. I am in a position to start a new browser with process.start().
Now I have to open that browser in a specific size(say height:300 width:500)
Process.Start("firefox.exe", "abc.html")
and I have written this following code on load of abc.html
var myRef = window.open('abc.html','','left=20,top=20,width=300,height=500');
but it does not resize.
If I add 1 button on this page and click on it (by writing same code on its click event), a new window with expected size opens.
Am I going wrong somewhere?
Thanx.
Firefox doesn't let pages resize the window by default. Also note, if you already have Firefox running then browser preferences will dictate whether you get a new window or a tab. You can force a separate instance of Firefox by using the -no-remote command line flag, but then you won't be able to use the default profile (only one Firefox instance per profile).
My questions for you are:
Why are you launching Firefox from another executable at all instead of just having users click on a link and have it open in their default browser?
If you do need to launch Firefox from an executable, why spend all this effort overriding the user's preferences and settings?
If you' re launching from an executable and are keen to annoy your users whatever the cost, why not just find and resize the Firefox window using the normal Windows APIs?
I created a frameless window using the new Google Chrome packaged apps, v2
I created the minimize, maximize, and close buttons and hocked them to the appropriate JavaScript functions and have them working.
I don’t know who to check if the window is already maximized in JavaScript, any ideas?
The following example is showing how to minimize a window, it took me some time to understand it and implement it, and it works.
https://github.com/GoogleChrome/chrome-app-samples/blob/master/frameless-window/style.css
The maximize button have to restore the window if maximized, and if you double click the window title bar it maximized but I don’t get any events.
This is currently not possible. Bug 134068 is filed for querying the properties of a window, and bug 134070 is filed for getting events when they change.
Seems to be possible now that those mentioned bugs were fixed in the last few weeks.