I want that javascript detects which browser I am using, and if it isn't safari redirect it to safari. My website is mostly build on Safari. So if someone is opening my website on another browser they will be redericted to the page on safari. ANYONE HAVE AN ANSWER?! (btw my english isn't the best)
Asked
Active
Viewed 396 times
0
-
11And what, if your user doesn't have Safari installed? – Sirko Sep 05 '13 at 13:34
-
sample code - http://jsfiddle.net/xButm/ – Sunil Mishra Sep 05 '13 at 13:37
-
1you should code your site to work in all browsers ... nobody wants you to choose what browser they should use – mcgrailm Sep 05 '13 at 13:49
1 Answers
0
There is no way to change the browser from inside the client. You can request that they open it, but not force them.
Your best bet would be to render the site correctly to Safari users and redirect users not using Safari to a page that asks them to instead install it.
How to detect the browser: http://www.quirksmode.org/js/detect.html
Example:
window.addEventListener("onload", function() {
if(BrowserDetect.browser === "safari") {
window.location.replace("usesafari.html");
}
});

Dan Prince
- 29,491
- 13
- 89
- 120
-
that code doesn't work properly, do you have any other similar suggestions – Sven van Holten Sep 05 '13 at 14:28
-
What about it doesn't work? Did you include the browser detect library? Did you create the use safari page? – Dan Prince Sep 05 '13 at 15:10