So, back to the post! When I was recently working my Javascript-awesomeness, I used win.open(), which worked great in Firefox and Chrome but did absolutely nothing in IE...
There are two possible solutions that immediately come to mind:
- The pop-up is actually working, but a pop-up blocker is blocking it.
- The pop-up isn't working because as far as IE is concerned your syntax is wrong.
Syntax
window.open(URL,name,specs,replace)
For example
The code below won't work in IE, since this contains spaces and an exclamation point:
window.open( 'https://www.google.com', 'This will open Google!', 'width=300,height=200,left=600,top=400,scrollbars=no,copyhistory=no,toolbar=no,location=no,menubar=no,directories=no,status=no,resizable=yes' );
The code below should work:
window.open( 'https://www.google.com', 'Google', 'width=300,height=200,left=600,top=400,scrollbars=no,copyhistory=no,toolbar=no,location=no,menubar=no,directories=no,status=no,resizable=yes' );
You can try this out in different browsers using the following fiddle: https://jsfiddle.net/4bbhu/2/ (link intentionally broken as this website seems to no longer exist). Chrome and Firefox should show two pop-ups, IE should show only one.
Below you can find some resources about the Javascript window.open()-method, listing all possible parameters:
W3Schools - https://www.w3schools.com/jsref/met_win_open.asp
Javascript-coder - https://www.javascript-coder.com/window-popup/javascript-window-open.phtml
Could be useful, right?
No comments:
Post a Comment