Forcing page to open as popup?

So this may be an odd request, but I’ve just finished putting together a GUI for a script which will run within another piece of software. A python script will be used to load the html project created in hype within a browser window. I would like to know if it is possible for the html file to open by default in a popup window?

I know it is possible to create a new pop up window using javascript, but in this instance I would like the browser to open straight into a new pop up window when the html file is opened, without opening a normal browser window first, even if the browser (most likely Chrome) is not already open. Does anyone know if this is possible?

I’m not sure it’s possible to open a browser straight into a pop up. Certainly you can open a new window and resize it to your specifications as you know. The problem is that most browsers will open a new window at the beginning and then open your popup. Also be careful as most browsers also have a “popup blocker” of some kind.

I’m thinking you can use javascript to resize the window once it’s loaded. Using:

///window.resizeTo(width, height);
window.resizeTo("600", "400");

be careful that the window is being opened on it’s own and with window.open

D

That’s very helpful thanks, I hadn’t considered that I could resize the window on opening.

The main reason I wanted a pop up window as they tend to have minimal UI elements on show compared to standard browser windows, i.e. no bookmark toolbars etc. Do you know if there is a way of forcing chrome into this type of environment?

for security most browsers won’t allow you to hide the address bar.

D

Worked out a way to do what I wanted, there is a flag you can use when launching Chrome which will give you a basic interface without address bar and toolbars:

open “/Applications/Google Chrome.app” --args --app=http://google.co.uk

with this and javascript window.resizeTo I should be able to do exactly what I want

1 Like