tqla Posted March 19, 2010 Share Posted March 19, 2010 Hello. I am using the following popup script. It looks great in FF but it opens wider in IE. Is there a way to sniff the browser and then use a different popup function in IE? <SCRIPT LANGUAGE="JavaScript"> function popup(w,h,p){ var left = (screen.availWidth/2) - (w/2); var top = (screen.availHeight/2) - (h/2); window.open(p,'Insert','width='+w+',height='+h+',scrollbars=0,status=0,menubar=0 left='+left+', top='+top) } </SCRIPT> <A HREF="javascript:popup(150,400,'selector.php')" >This will be the link</A> Link to comment https://forums.phpfreaks.com/topic/195847-sniff-for-ie-and-use-different-function/ Share on other sites More sharing options...
tqla Posted March 19, 2010 Author Share Posted March 19, 2010 Figured it out. First I check the browser with PHP <?php if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ){ $b = "javascript:popup(120,400,'selector.php')"; }else{ $b = "javascript:popup(150,400,'selector.php')"; } ?> Then I echo into my href <A HREF="<?php echo $b; ?>" >This will be the link</A> bingo! Link to comment https://forums.phpfreaks.com/topic/195847-sniff-for-ie-and-use-different-function/#findComment-1028810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.