guitarscn Posted October 11, 2008 Share Posted October 11, 2008 I want to put some 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? Link to comment https://forums.phpfreaks.com/topic/127988-how-to-detect-browser-and-re-direct/ Share on other sites More sharing options...
JasonLewis Posted October 11, 2008 Share Posted October 11, 2008 JavaScript can do it. Not sure about PHP, I've seen some things but... JavaScript would be the best method for this. Googling something like "JavaScript Browser Detection". Link to comment https://forums.phpfreaks.com/topic/127988-how-to-detect-browser-and-re-direct/#findComment-662739 Share on other sites More sharing options...
Maq Posted October 11, 2008 Share Posted October 11, 2008 Here's a good link for browser detection. For redirect use: window.location = "http://www.google.com/" Link to comment https://forums.phpfreaks.com/topic/127988-how-to-detect-browser-and-re-direct/#findComment-662749 Share on other sites More sharing options...
BoltZ Posted October 25, 2008 Share Posted October 25, 2008 heres what you can do. <html> <head> <title>Redirection</title> <script type="text/javascript"> var browserName=navigator.appName; if (browserName=="Netscape")//Mozilla Firefox Chrome { window.location="firefox.htm"; } else { if (browserName=="Microsoft Internet Explorer") { window.location="msiebrowser.htm"; } else //Opera Safari { window.location="otherbrowser.htm"; } } //Note to just have a redirectoin for EVERY single browser //just play around with the names and tell me if you need help. //Before asking try googling it </script> </head> <body> <noscript><h1>You must have javascript enabled to view this page correctly</h1><noscript> </body> </html> This code is tested and it works Link to comment https://forums.phpfreaks.com/topic/127988-how-to-detect-browser-and-re-direct/#findComment-674312 Share on other sites More sharing options...
TheFilmGod Posted October 26, 2008 Share Posted October 26, 2008 did you try google? Link to comment https://forums.phpfreaks.com/topic/127988-how-to-detect-browser-and-re-direct/#findComment-675044 Share on other sites More sharing options...
BoltZ Posted October 26, 2008 Share Posted October 26, 2008 No actually I coded that but I learned that stuff on pageresource.com. Its great Link to comment https://forums.phpfreaks.com/topic/127988-how-to-detect-browser-and-re-direct/#findComment-675046 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.