The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Web Programming, Web 2.0 and Mashups
.
google unix.com



Web Programming, Web 2.0 and Mashups Discuss Web Programming and Web Server Administration, including LAMP, Apache, MySQL, Flash, HTML, SEO, Mashups and other Web APIs and topics.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Re-direct the error msg to log file rony_daniel Shell Programming and Scripting 4 11-21-2006 02:05 PM
How to direct FTP command to use a specific IP add or NIC ? pray44u SUN Solaris 5 06-02-2006 12:49 AM
Direct disk access Lopatonosec High Level Programming 3 05-31-2005 12:39 PM
How to direct awk output to expr? jvander Shell Programming and Scripting 4 04-21-2005 09:09 PM
direct transmission of files via TCP/IP darkspace High Level Programming 5 08-26-2002 02:00 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-11-2008
Registered User
 

Join Date: Mar 2008
Posts: 17
How to detect browser and re-direct

I want to put some HTML code on my page that will detect the user who goes to my site's browser, and if it's a certain browser (like Internet Explorer or Mozilla Firefox), it will re-direct them to another page I have. How can I do this?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-11-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,769
You either do this in your (a) web server's configuration, (b) web server script, or (c) in Javascript which you include or refer to from your HTML page. If it's Javascript, there's many many choices, and I suggest you search free code libraries for such code. Here's one exmple. Once you have the browser, you will do something like

Code:
 window.location="http://new.url/somewhere.else"
Reply With Quote
  #3 (permalink)  
Old 10-12-2008
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,611
You can examine the HTTP "User-Agent" header that may carry information about the user's browser used. How to do depends on your server-side development platform (e.g. CGI/PHP/Java etc.) However, because that field can be easily forged, it is not necessarily accurate but that is mostly what you can do.

For redirects, there are mainly 2 ways: HTTP redirect and HTML-based (browser) redirect. With HTTP redirect the server-side generates a redirect (a "moved" HTTP response) that the browser responds to. The second way is to generate a meta tag in the HTML returned to browser, that the browser will do the redirect, but only after the original response is rendered completely. Again, how to do depends on your development platform.

The main difference is that HTML-based redirect will break the "back" button. If the user presses the back button after the redirect, the browser will run the redirect again and the end result is the user is not redirected.

You do not necessarily need to do this with programming. I think you can also implement some of these redirect schemes with certain Apache configuration directives. Dealing with this the Apache way is not my favourite, but that is up to you.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Bookmarks

Tags
None

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:




All times are GMT -4. The time now is 07:30 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66