-3

I'm developing a business websites, on which certain Javascripts and HTML work with Firefox only. How can I force user to not use other browser, something like when they open the site on Chrome, IE or Opera, they will receive a message and will be redirected to an info page.

FYI, the language I used is ASP.NET Web Form.

Edited: The solution has more than 200 pages, so I think I'll put it in a Masterpage

Edit 2: Javascript or Server script is ok

Edit 3: Reason: I'm using a third-party HTML control library. That library's DataGrid is used intensively. On the DataGrid, I always have some hidden columns and this works well with Firefox. But on Chrome, the hidden columns are exposed. Since there is no fix and I'm not ready to upgrade the library, I would like to ban other browsers as an immediate measure

Thank you

9
  • 2
    Didn't you tried to search for it, seriously?! Commented Mar 13, 2014 at 17:17
  • Use modernizr, you will thank me later. Commented Mar 13, 2014 at 17:17
  • 1
    Have you thought about this another way: maybe you should update your JavaScript and HTML to be cross platform compatible? I usually find that if I did something that isn't cross-platform, it's a "kludge" and it's difficult to support. Commented Mar 13, 2014 at 17:20
  • Your best bet is going to be checking the user agent on the server side since users can disable Javascript. Is this an internal or external site? If it's internal, your policy should be "this is the standard browser." If it's external, this is probably a bad idea. (I really haven't seen a browser-specific page since the late 1990s) Commented Mar 13, 2014 at 17:21
  • The problem is that I put "Javascript" in the title. Sorry for that, because my user sometimes turn off Javascript. So apart from Javascript, is there anything else ? @Tim: it's an internal site, with sensitive information Commented Mar 13, 2014 at 17:21

3 Answers 3

0

what you want is identifying browser : How to detect Safari, Chrome, IE, Firefox and Opera browser? they will need javascript turned on though

Sign up to request clarification or add additional context in comments.

2 Comments

So forget about JS, can we modify global.asax ?
You could check the User-Agent request header in the Global.Asax for Firefox and send back a 403 http status for browsers that aren't FireFox. What the other people said though: don't get comfortable with this solution
0

In your master page header put:

 if(typeof InstallTrigger == 'undefined')
   alert('Please use firefox');
   // and whatever else like a redirect or something..

Comments

0

You can use the 'sayswho' script referenced in DontVoteMeDown's comment above along with a confirm() call.

if (!navigator.sayswho.match(/^.*firefox.*$/i)) {
  if (confirm("This site is optimized for Firefox,  it may not work with your browser.  Do you want to download Firefox now?"))
  {
    document.location="http://www.mozilla.org/en-US/firefox/new/";
  } else {
    // go someplace else or let them use at their own risk
  }
} 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.