looking for a broswer detection redirect script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • milkhead
    Confirmed User
    • Sep 2009
    • 186

    #1

    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
    Confirmed User
    • Jun 2003
    • 3304

    #2
    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/
    Last edited by machinegunkelly; 10-14-2012, 03:28 AM.
    dead.

    Comment

    • milkhead
      Confirmed User
      • Sep 2009
      • 186

      #3
      Originally posted by machinegunkelly
      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.

      Comment

      • machinegunkelly
        Confirmed User
        • Jun 2003
        • 3304

        #4
        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..
        Last edited by machinegunkelly; 10-14-2012, 07:40 PM.
        dead.

        Comment

        • milkhead
          Confirmed User
          • Sep 2009
          • 186

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

          Comment

          Working...