Jump to content

window.open() function do not work on IE


php_developer

Recommended Posts

You don't need an alternate. You do need to post your code so we can see what's wrong. OTOH, there might be a tool in jQuery that will do what you want in a more user-friendly way. So maybe you could explain what your goal is, too.

Link to comment
Share on other sites

also check for errors in the console, I imagine if it's not working then there's at least a chance there are some.

Link to comment
Share on other sites

<a href='javascript:window.open("<?php echo $sitelink; ?>/filename.php", "mywindow","directories=0,titlebar=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=no,resizable=no,width=400,height=300")' style="text-decoration:none">Link name</a> This is my code, I have issue with. Please check and tell me what is the problem, why is this not working in any browser other than chrome... Or any alternate to it...

also check for errors in the console, I imagine if it's not working then there's at least a chance there are some.
I do not know anything about console.. Please tell me how can I check the error on console... Edited by php_developer
Link to comment
Share on other sites

Oops. Just noticed something. This might be new since I last put JS in a link. The whole window.open command ended up in my address bar. The content of my original window was obliterated and replaced with the return value of window.open. Changing the code to this fixed that: 'javascript:var x=window.open( etc. . . . But the best solution is probably not to use an <a> element at all. Use a <p> or a <span> and add an onclick handler.

Link to comment
Share on other sites

It's not actually the tag that's the problem, but the attribute. You were using the href attribute when you should be using one of the many event attributes. The "javascript:" portion can and should be omitted when using an event attribute even if browsers work when you put it.

Link to comment
Share on other sites

Okay... I wrote the span tag as: <span onclick='javascript:window.open("<?php echo $sitelink; ?>/filename.php", "mywindow","directories=0,titlebar=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=no,resizable=no,width=400,height=300")' style="text-decoration:none">Link name</span> So, Should I remove "javascript:" Is onclick an event attribute..?

Link to comment
Share on other sites

Yes, any attribute starting with "on" is an event attribute. You can study about them here: http://www.w3schools...tattributes.asp It is preferable to remove the "javascript:" part. In the future it might not be supported because it's redundant and was intended only for the href attribute.

Link to comment
Share on other sites

window.open() function working properly on chrome but do not work on IE and Firefox, Is there any alternate to this function. Please help...
lower version of ie will not work it should be more the ie8ie8 or else more for firefox it should be more than 3.8what ever the latest version is? Edited by xhtmlchamps1
Link to comment
Share on other sites

Please do not create misinformation. window.open() has been working for Internet Explorer since at least version 5.5 and most likely since before then as well. Firefox has supported it since the very beginning.

Link to comment
Share on other sites

<span onclick='javascript:window.open("<?php echo $sitelink; ?>/filename.php", "mywindow","directories=0,titlebar=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=no,resizable=no,width=400,height=300")' style="text-decoration:none">Link name</span>
my this code is working Pretty well for IE8, firefox and chrome. Thank You so much for all your help and support.. :rolleyes:
Link to comment
Share on other sites

window.open() has been working for Internet Explorer since at least version 5.5 and most likely since before then as well. Firefox has supported it since the very beginning.
FWIW, Google found some old references indicating that window.open was supported by IE 3 and Netscape 3. That's roughly 1996. IE 3 was the first version of IE to include JavaScript. I wish I still had some of my first textbooks on this stuff.
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...