Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prompt user to "Open firefox" if the website is opened in "IE"

I have a website,which is "currently" designed & tested to work only on firefox.If user tries to open it in other browser then I want to show a popup saying "This site works best with Mozilla Firefox. We're working hard to add support for your favorite browser. Meanwhile, do try it with Firefox."

Can we provide a buttion on clicking of which, one new window will be opened in firefox preloaded with some URL ? and also tells us in case firefox is not available at its default location ?

Thanks, Sourabh

like image 482
Sourabh Avatar asked Feb 27 '23 21:02

Sourabh


2 Answers

If you make your website standard-conformant, chances are pretty high it will work in Firefox, Opera and WebKit-based browsers (Safari, Chrome), without having to use much browser-specific code. Problem is, as usual, with IE. To achieve best results, write a website for standard-compliant browsers, then add hacks to make it work in IE.

You cannot detect installed applications on client computer, nor launch any of them - beacuse of security. All you can do is to do browser sniffing. You can do it on server side (by examining User-Agent header), or on client side (using JavaScript to check window.navigator object). It is quite complicated and error-prone though and certainly not forward-compatible (future browser versions may confuse your scripts). Moreover, users can change their browser's identification. When you detect unsupported browser, you could display some popup asking user to switch browser.

If you want to detect only IE, you can use IE's conditional comments, which is a most reliable way for detecting IE.

like image 139
el.pescado - нет войне Avatar answered Mar 06 '23 21:03

el.pescado - нет войне


You can't test for Firefox being available nor start it using JavaScript. That would create big security holes...

You can try to figure out if the current browser is Firefox and output a message, although I really hate them (remember that not every visitor will be able to install/use another browser, e.g. within companies or public places).

like image 20
Marcel Korpel Avatar answered Mar 06 '23 21:03

Marcel Korpel