Looking for a broswer detection redirect script. Example it detects ie and redirects to page 1, detects firefox and it redirects to page 2 and etc. Any suggestions?
looking for a broswer detection redirect script
Collapse
X
-
jquery.
easy peasy.
etc ...Code:$(document).ready( function(){ if ($.browser.webkit) { window.location = 'http://www.google.com/'; } else if ($.browser.msie) { window.location = 'http://www.yahoo.com/'; } else if ($.browser.opera) { window.location = 'http://www.opera.com/'; } else if ($.browser.mozilla) { window.location = 'http://www.firefox.com/'; } })
http://api.jquery.com/jQuery.browser/Last edited by machinegunkelly; 10-14-2012, 03:28 AM. -
thanks for your help machinegunkelly. quick question though, where do i put the code? Like does it go in the body tag, head tag or etc and how do I put something for all other browser goto page whatever.com.jquery.
easy peasy.
etc ...Code:$(document).ready( function(){ if ($.browser.webkit) { window.location = 'http://www.google.com/'; } else if ($.browser.msie) { window.location = 'http://www.yahoo.com/'; } else if ($.browser.opera) { window.location = 'http://www.opera.com/'; } else if ($.browser.mozilla) { window.location = 'http://www.firefox.com/'; } })
http://api.jquery.com/jQuery.browser/Comment
-
That should work anywhere you stick it..and the last else is for all other browsers..Code:<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script> <script> $(document).ready( function(){ if ($.browser.webkit) { window.location = 'http://www.webkit.org/'; } else if ($.browser.msie) { window.location = 'http://intrenet.net/explorer-survey-new/'; } else if ($.browser.opera) { window.location = 'http://www.opera.com/'; } else if ($.browser.mozilla) { window.location = 'http://www.firefox.com/'; } else { window.location = 'http://www.otherbrowsers.com/'; } }) </script>Last edited by machinegunkelly; 10-14-2012, 07:40 PM.Comment

Comment