views:

291

answers:

8

Hi there

I want to redirect to Internet Explorer from other browsers by JavaScript. How can I do that?

+17  A: 

You can't.

In a standard security context, browsers provide no way of launching other programs (and a goodly number of systems don't have Internet Explorer anyway). In non-standard security contexts, most browsers still don't provide a way of launching other programs.

David Dorward
Unfortunately there is no way to "redirect to a decent browser from IE by javascript". That would be so nice.
Andreas Bonini
@Andreas Bonini - Koper: I'm sure you're just joking but even that would be annoying - some people use IE for valid reasons.
Andy E
+6  A: 

javascript does not allow you to execute programs (like Internet Explorer) from another web browser. This isn't possible.

I would recommend to either:

  • Show an error/warning that the site doesn't work or might not work correctly when not using IE
  • Fix the site to work cross-browser (recommended)
Sander Rijken
+1 for not only explain why can't, but also give some suggestions.
Iamamac
A: 

Short answer is: you can't.

Andy E
A: 

You can't.

As far as I'm concerned, I'd love the other way around: redirect any user with IE6 to Firefox/Chrome/safari :-)

Jerome
+1  A: 

You should just develop websites that are viewable in all common browsers ;). No work-arounds for people using different browser types / version. When developing websites just make sure you meet the standards and all websites have sheets for the common browsers.

Younes
+2  A: 

Short answer is that you can't.

The real reason is security, which will (hopefully) always prevent you from running applications on the user's computer, but even if there weren't for that reason... I'm sorry, I just have to nitpick a bit here. What you're trying to do should be absolutely unacceptable in no uncertain terms to every single user and developer. I think I can safely speak for the overwhelming majority of experienced web developers, that techniques designed to dictate to the user which browser to use are always, always, always wrong, not just technically but morally. Yes, I used the M-word. It's immoral to make those sorts of decisions for your users, no matter how dumb they are. Warn them if your site is designed specifically for a particular browser, that's fine, but don't make the actual decision for them.

Sorry, I know this ain't the place for arguing, but I do believe this needs to be clear because it's a real problem in web development that really does waste time and really does cost money and really does harm the web as a whole.

So as far as I'm concerned, I'm glad these security measures are there, because this is an extraordinarily bad idea in the first place, even without the security risks.

No disrespect intended. It just had to be said.

Helgi Hrafn Gunnarsson
+2  A: 

Im sorry if I dont agree with anyone kicking IE around. Yes, it's a bit of an animal to tame, but the larger the animal the bigger the meat it can consume. Indeed it's a memory hog at time, indeed it takes a really seasoned developer to overcome minor bugs, but the reality of the matter is IE is a dog we must contend with. Wouldn't necessarily make everyone jump to IE as cagin is requiring of his users, but don't knock down IE either.

What I have found over my 12 years of developing front-end interfaces is: You'd be better off to start development on IE and test for bugs on Firefox, Opera, Safari and Chrome opposed to going about it the other way around. With this method I have indeed developed some of the most intricate of front-end application interfaces and in the end, NO BUGS. Really no bugs. If you know the DOM, HTML, CSS, JavaScript (not jQuery and the like), surely you'll be able to overcome most if not all cross-browser inefficiencies. I stand by this word and can prove this to be the best way to make the entire cross-browser issue dissapear!

drlouie - louierd
Interesting, in my experience I found more efficient to do exactly the opposite, i.e. design the site as compliant as possible to the standards and then, eventually, tweak it for IE. I ended up with shorter development time and simpler pages. It seems that, also in this case, there's more than one way.
Diego
+3  A: 

Why IE ?? redirect your visitors to Firefox :D

This simple javascript can runs firefox.exe from C:\Program Files\Mozilla Firefox ( YES I KNOW IT CAN BE SOMEWHERE IN E: OR D: .... but as I know the default path of Firefox is C:\Program Files\Mozilla Firefox ... you can complete this script and find the correct path of firefox.exe :D )

this HELL script only runs in IE and shows that IE6 is really insecure. ( of course it shows a warning message ;) )

[EDIT] OF COURSE I'm not suggest you 'FORCE' visitors using your favorite browser ;)

<html>

<head>

<SCRIPT Language="JScript">
   function runFirefox() {
   File="c:\\PROGRA~1\\MOZILL~1\\FIREFOX.EXE http://stackoverflow.com"; 
   WSH=new ActiveXObject("WScript.Shell");
   WSH.run(File);
 }
</SCRIPT> 

</head>

<body onLoad="javascript:runFirefox();">
   <b>For the best experience we FORCE you using Firefox.</b> 
</body>

</html> 
Michel Kogan