Reputation: 9708
The javascript/html below creates a small popup window to the bottom right of the users screen. This code works on Chrome and Firefox but not on IE v9 for some reason.
In the IE9 debugger it says Line: 17 Error: Invalid argument.
line 17 being the line starting var win = window.open(...
In the debugger I see:
HTML1202: http://xyzserver:8080/path/test_popup.html is running in Compatibility View because 'Display intranet sites in Compatibility View' is checked.
and
SCRIPT87: Invalid argument. test_popup.html, line 17 character 3
character being the v in var win = ...
Anyone any ideas?
<!DOCTYPE html>
<html>
<head>
<script>
function open_win(data)
{
var w = 200;
var h = 200;
var left = (screen.width - (w * 1.1));
var top = (screen.height - (h * 1.1));
var win = window.open('', 'about:blank', 'width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
win.document.write("<p>Received: " + data + "</p>")
win.focus()
}
</script>
</head>
<body>
<form>
<input type="button" value="Open Window" onclick="open_win('information here')">
</form>
</body>
</html>
Upvotes: 0
Views: 1612
Reputation: 37846
try this:
var win = window.open('', '', 'width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
so without 'about:blank'
because Microsoft does not support a name as second argument.
or you should say: window.open('_blank', '', 'width='...)....etc
giving the name as a first argument.
Upvotes: 0
Reputation: 318488
You need to pass about:blank
as the first argument instead of the second one (which is the window name that apparently may not contain a .:
in IE)
Upvotes: 3