Jump to content
Sign in to follow this  
php_developer

window.open() function do not work on IE

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.

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I'm using Firefox, and that code opens a window correctly. Please explain what happens in your browser and what you mean by "not working." Does a window open? Is the location wrong?

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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..?

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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:

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

I am using the exact example shown at w3schools of window.open and it fails in IE11 on Windows 7, but works in all other browsers. Am I missing a setting somewhere?

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...