How to detect browser and re-direct


 
Thread Tools Search this Thread
Top Forums Web Development How to detect browser and re-direct
# 1  
Old 10-11-2008
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?
# 2  
Old 10-11-2008
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"

# 3  
Old 10-12-2008
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Direct Printing In AIX

Hello. I recently upgraded to a new Power 8 server and running AIX 7.1. I migrated from an IBM P520 and AIX 5.5. My application on the P520 works best if I direct print, it doesn't work well with spooling. My IBM rep set up the new Power 8 server with spooling which is causing an issue.... (4 Replies)
Discussion started by: ldavis1080
4 Replies

2. Shell Programming and Scripting

File not exist in direct

friends can do this from unix AIX I need to ask for a file that does not exist then if file.txt * **** echo "execute procedure" else *** echo "File does not exist" if You can sucedere that the file does not exist (2 Replies)
Discussion started by: tricampeon81
2 Replies

3. Shell Programming and Scripting

Direct read / load

Guys, I wrote a script to do the following - Read a file that is placed into a directory and depending upon the contents, load into one or multiple tables into Oracle. After the file is loaded into the table, depending upon the exit status of the process I will either delete the file or... (3 Replies)
Discussion started by: ManoharMa
3 Replies

4. UNIX for Dummies Questions & Answers

Can I re-direct nohup to a different filename?

Hi, I want to be able to run a script nohup & but I want the output file named like <script>.out instead of nohup.out. Is there anyway to achieve this? At the moment, workaround is I cd to a different directory and then do nohup <script> &. So far, I've tried below but it does not seem to... (2 Replies)
Discussion started by: newbie_01
2 Replies

5. Shell Programming and Scripting

Manipulating sed Direct Input to Direct Output

Hi guys, been scratching round the forums and my mountain of resources. Maybe I havn't read deep enough My question is not how sed edits a stream and outputs it to a file, rather something like this below: I have a .txt with some text in it :rolleyes: abc:123:xyz 123:abc:987... (7 Replies)
Discussion started by: the0nion
7 Replies

6. Shell Programming and Scripting

Connect:Direct

Hello all, I have a requirement to transfer files to mainframe usinf NDM connect:direct. So can anybody provide me a sample shell script on how to call a connect;direct script by providing filename as a parameter please? Thanks, Ajay (0 Replies)
Discussion started by: ajaykumar4534
0 Replies

7. UNIX for Dummies Questions & Answers

re-direct to log file

#!/bin/ksh -x cd /tmp/tj ftp -n servername.com << DONE user username password as put test.log quit close DONE echo "testing..." sh -x scriptname, and it shows all, but username, as, put, quit, close, DONE. how can i see those ? (1 Reply)
Discussion started by: tjmannonline
1 Replies

8. Solaris

Direct login without password

Hi, I am trying to setup direct login from server test1 (Solaris 10) to server test2 (Solaris 9) using id taops (ldap id). Process Followed on Test 2. created .rhosts file in home directory of user taops geneted public key on test1 and appended to authorized keys on test2. Now trying... (8 Replies)
Discussion started by: tuxian
8 Replies

9. Shell Programming and Scripting

Problem using connect direct

Hi, I have a script in which i'm using ndm connect direct to fetch data from the client server..syntax i'm using is ./con_using_connectdirect /load/nctrl nctrl $xhost where con_using_connectdirect is the script which establishes connection load/nctrl is the path from where data... (4 Replies)
Discussion started by: Sheema
4 Replies
Login or Register to Ask a Question