GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   looking for a broswer detection redirect script (https://gfy.com/showthread.php?t=1085259)

milkhead 10-13-2012 11:40 PM

looking for a broswer detection redirect script
 
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?

machinegunkelly 10-14-2012 04:18 AM

jquery.

easy peasy.

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/';
        }

})

etc ...

http://api.jquery.com/jQuery.browser/

milkhead 10-14-2012 07:12 AM

Quote:

Originally Posted by machinegunkelly (Post 19250402)
jquery.

easy peasy.

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/';
        }

})

etc ...

http://api.jquery.com/jQuery.browser/

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.

machinegunkelly 10-14-2012 08:35 PM

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>

That should work anywhere you stick it..and the last else is for all other browsers..

milkhead 10-23-2012 06:57 PM

sorry for the delay but thanks for your help, i really appreciate it...


All times are GMT -7. The time now is 01:58 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123