Hello all.... I am a rookie programer and I am learning javascript as needed I am fairly good with perl....my site will only work correctly with IE. Is there a way with javascript to detect browser and if its not ie to use a confirm box to redirect and open a new window with my site in IE thank
You can use javascript's navigator object to get the browser info.
then check it against known browser names to see which one the client is using.Code:var browser=navigator.appName; or var userAgent = navigator.userAgent;
You can find more info about the navigator object in (www).w3schools.com/js/js_browser.asp) and (www).javascriptkit.com/javatutors/navigator.shtml)
However as for your second question (force the user to open a new window in IE) I don't believe its possible.
if you want my opinion you should try to make your site cross browser compatible.
I would strongly discourage you from requiring IE for your site. It is slowly losing market share, and people who are using Macs or Linux cannot run it. Since most javascript can be made cross-browser compatible, why not do that instead?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks