Jump to content

Basic Js To Force Open New Window With Size


yandoo

Recommended Posts

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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')">

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.