php_developer Posted January 28, 2013 Share Posted January 28, 2013 window.open() function working properly on chrome but do not work on IE and Firefox, Is there any alternate to this function. Please help... Link to comment Share on other sites More sharing options...
jeffman Posted January 28, 2013 Share Posted January 28, 2013 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 More sharing options...
thescientist Posted January 28, 2013 Share Posted January 28, 2013 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 More sharing options...
php_developer Posted January 29, 2013 Author Share Posted January 29, 2013 (edited) <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 January 29, 2013 by php_developer Link to comment Share on other sites More sharing options...
jeffman Posted January 29, 2013 Share Posted January 29, 2013 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? Link to comment Share on other sites More sharing options...
justsomeguy Posted January 29, 2013 Share Posted January 29, 2013 There are also links in my signature if you want to look into your browser's error console. Link to comment Share on other sites More sharing options...
jeffman Posted January 29, 2013 Share Posted January 29, 2013 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 More sharing options...
php_developer Posted January 30, 2013 Author Share Posted January 30, 2013 I used the "span" tag then it start working properly...So the problem was only because of the anchor tag "<a>".. Thank You so much.. ... Link to comment Share on other sites More sharing options...
Ingolme Posted January 30, 2013 Share Posted January 30, 2013 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 More sharing options...
php_developer Posted January 30, 2013 Author Share Posted January 30, 2013 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 More sharing options...
Ingolme Posted January 30, 2013 Share Posted January 30, 2013 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 More sharing options...
xhtmlchamps1 Posted January 31, 2013 Share Posted January 31, 2013 (edited) 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 January 31, 2013 by xhtmlchamps1 Link to comment Share on other sites More sharing options...
Ingolme Posted January 31, 2013 Share Posted January 31, 2013 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 More sharing options...
php_developer Posted January 31, 2013 Author Share Posted January 31, 2013 <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.. Link to comment Share on other sites More sharing options...
jeffman Posted January 31, 2013 Share Posted January 31, 2013 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 More sharing options...
Archdeacon Posted February 26, 2014 Share Posted February 26, 2014 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? Link to comment Share on other sites More sharing options...
davej Posted February 26, 2014 Share Posted February 26, 2014 I see they are having some trouble with IE11. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now