![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 03: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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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?
|
|
|||||
|
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" |
|
||||
|
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. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|