When using the below to open a new window in Chrome the window always opens maximized. In Firefox it opens at the correct 200x200 size, so how can I get Chrome to behave the same and not maximize?
gamewindow = window.open("","","width=200,height=200");
I'm now finding that if I include location=0 and menubar=0 that they still show up in both Firefox and Chrome. What's the deal with this? Is there some other way to do pop out windows because it seems window.open is unreliable.
I'm testing your example on win7 and it works fine on chrome, at least for me
Have a look at this fiddle
Are you using it on a maximized (fullscreen) window on Mac?
Btw, I would not recommend using window.open since it usually gets blocked by pop-up blocker
Edit: tested on Chrome stable, build 28.0.1500.95 m
Related
Self.close() is working For IE but For Chrome and Firefox it shows that
Scripts may close only the windows that were opened by it.
And This Page will not a popup and it is not open by java script so what are the alternative way to close window by Script which is not open by it.
You simply can not close the window by script due to security reasons on chrome and firefox. But there is a workaround posted here.
That works on chrome 40 and latest version as I have tested.
chrome closing of opened window
I know it's too late to answer but none of these solution worked for me . I wrote
onclick="top.window.close();"
and it worked .
So I'm getting a little bug using this simple window.open javascript function on iOS browsers. When I click it I get 2 windows opening. Has anyone run into this problem and does anyone have a work around?
Open page in new window
Thanks!
It's not a bug. You are opening two windows: one because you have an <a> with a target="popup", the other one because you window.open a "name". The only reason it doesn't happen in desktop is because most desktop browsers would exercise their popup-blocker.
I am currently using Mozilla Firefox 30.0 and it seems that it doesn't support window.close() anymore.
You may refer on the image below or if it is too small for you, here is the
link.
I opened the website of Google using window.open and then I tried to close it using window.close() but it says undefined.
Is there any other option that I can using to close the window using javascript on firefox?
The Firebug console unfortunately does not display the warning that goes along with it, which reads (in the regular Firefox Web Console}:
Scripts may not close windows that were not opened by script.
Also MDN window.close states:
This method is only allowed to be called for windows that were opened by a script using the window.open method.
So, you aren't allowed to call window.close() on windows that were explicitly opened by the user.
PS: This isn't new behavior, but around for ages (even before Firefox was called Firefox).
PS: To give an example, you are allowed to do something like this, only, i.e. close a window returned from window.open:
var w = window.open("http://google.com");
setTimeout(function() { w.close(); }, 1000);
I am using Google Chrome Frame (GCF) with IE9 and when I open a javascript dialog it opens in a tab instead of a dialog.
My IE setting for 'Tabbed Browser Settings' -> 'When a pop-up is encountered:' -> 'Let Internet Explorer decide how pop-ups should open'
I use this javascript to open a window:
window.open("http://google.com/", "_blank",
"location=0,status=no,toolbar=no,menubar=no,width=800,height=600,scrollbars=no,resizable=no");
If I change the IE setting to 'Always open pop-ups in a new window' it works. The problem lies in that I need to change that setting on every IE9 computer in the company and the computer administrators are hesitant to do this.
According to Microsoft documentation if you specify a width/height it will open in a dialog but this is not the case when using GCF.
Is there anything I can do (other than changing the setting) that will force the dialog to open in a new window instead of a tab?
Also IE is crafty it tells you it changes the setting but sometimes it actually doesn't so when testing close out of the browser all the way after changing the setting (I got all excited once after it 'worked' but it was actually the setting not updating in IE).
You have to use the rel="noreferrer" in a standard link (no window.open).
I went through reams of documentation trying to figure this out.
Fortunately ChromeFrame isn't needed as much since IE11 seems to support most things (although IE11 has a horrible memory leak).
[a href="http://www.google.com" rel="noreferrer" target="_blank"]Rel No Referrer Is the Key[/a]
what is the right use of window.open in IE8?
window.open('prova.php','prova','width=350,height=250');
is good in firefox but not in IE8
window.open works across browsers. And your code works fine for me in IE8 too. It could be some other reason like your pop-up is being blocked, check the settings just in case.
Check out:
Learn to Disable Internet Explorer 8’s Top 3 Most Annoying Alerts
IE8 has a native popup blocker. You have to manually enable popups. You can try NOT using window.open and instead inject html in the form of a modal in the page.