0

I have a index.html page, which contains a buttonid="my-btn"

<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>My INDEX PAGE</title>
    </head>
    <body>
        <br><input type="button" id="my-btn" value="OPEN NEW WINDOW"/>
        <script src="js/jquery-1.5.1.js"></script>
        <script src="js/my.js"></script>
    </body>
    </html>

js/my.js handles button click event, when my-btn button is clicked, a new browser window will be popped up with a new page(test.html)

my.js:

$('#my-btn').click(function(){  
  window.open('test.html', 'testwindow');
});

The new page(test.html) opened in new browser window:

test.html:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TEST</title>
</head>
<body>
    <div id="my-name"></div>
    <script src="js/jquery-1.5.1.js"></script>
    <script src="js/test.js"></script>
</body>
</html>

Every thing is working fine in FireFox, but I got problem in IE 7.

In IE 7, when my-btn is clicked, the new window is not popped up, instead, I got error message "Invalid argument" which is point to my js code window.open('test.html', 'testwindow');, how to make it working in IE then???

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Leem
  • 17,220
  • 36
  • 109
  • 159

2 Answers2

1

Try window.open('test.html',''); (according to this question/answer ie8 var w= window.open() - "Message: Invalid argument.")

Community
  • 1
  • 1
egis
  • 1,404
  • 2
  • 11
  • 24
0

Read this.. The problem lies with you second argument..

niksvp
  • 5,545
  • 2
  • 24
  • 41