yandoo Posted November 30, 2012 Share Posted November 30, 2012 Hi I'm using a little js to open a specified sized new window on my webpage. It works fine in firefox and chrome but doesn't work in IE 8. An error code in Ie says "invalid argument". Is there a away around this or a better way to do it? <a href="#" onclick="window.open('feeds.html', 'RSS Feed List', 'width=800, height=800')"> <img src="images/rss.jpg" width="32" height="32"/></a> Thank you Quote Link to comment https://forums.phpfreaks.com/topic/271402-basic-js-to-force-open-new-window-with-size/ Share on other sites More sharing options...
Adam Posted November 30, 2012 Share Posted November 30, 2012 Can't spot anything wrong with it. Is the error definitely coming from that line? Quote Link to comment https://forums.phpfreaks.com/topic/271402-basic-js-to-force-open-new-window-with-size/#findComment-1396438 Share on other sites More sharing options...
yandoo Posted November 30, 2012 Author Share Posted November 30, 2012 Well in IE error it points to character 1 of this line: <td width="17%" align="right" valign="middle"><img src="images/fbbadge.jpg" width="32" height="32" /> <img src="images/twitterbadge.jpg" width="32" height="32" /> <a href="#" onclick="window.open('feeds.html', 'RSS Feed List', 'width=800, height=800')"> <img src="images/rss.jpg" width="32" height="32"/></a></td> This isnt even the line of code the js is on. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/271402-basic-js-to-force-open-new-window-with-size/#findComment-1396470 Share on other sites More sharing options...
yandoo Posted November 30, 2012 Author Share Posted November 30, 2012 I have noticed that # appears in url after index.php after clicking. If i remove the # out of the <a href="#" onclick="window.open('feeds.html', 'RSS Feed List', 'width=800, height=800')"> There is not error but it still doesnt open a new window in IE. Its strange because it all works just fine in FF and Chrome. I cant put feeds.html within the hyperlink because it will just go to that page in the current window. Quote Link to comment https://forums.phpfreaks.com/topic/271402-basic-js-to-force-open-new-window-with-size/#findComment-1396473 Share on other sites More sharing options...
kicken Posted November 30, 2012 Share Posted November 30, 2012 The name parameter should not contain any spaces or special characters. window.open('feeds.html', 'rssfeed', 'width=800,height=800') Also, this would be a better way of coding it which will allow the link to work still even if JS is disabled: <a href="feeds.html" onclick="return !window.open(this.href, 'rssfeed', 'width=800,height=800')"> Quote Link to comment https://forums.phpfreaks.com/topic/271402-basic-js-to-force-open-new-window-with-size/#findComment-1396542 Share on other sites More sharing options...
yandoo Posted December 2, 2012 Author Share Posted December 2, 2012 Thank you very much thats works a treat! Quote Link to comment https://forums.phpfreaks.com/topic/271402-basic-js-to-force-open-new-window-with-size/#findComment-1396881 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.