Internet Explorer ver 11 enterprise mode detection - javascript

Recently my team has landed in a weird situation. End of last year we migrated from IE 8 to IE 11. Our application is now designed to work in IE 11 Enterprise mode.
We need to display a javascript alert message to upgrade the Browser if the user is using IE 8. Alert message is successfully displayed to the users who use IE 8. But problem occurs when the alert message is also displayed to the users who are using IE11 in enterprise mode. I know that IE11 Enterprise mode basically emulates IE 8 behavior and that is the reason why our browser detection functionality is failing.
So I wanted to check if someone has implemented this kind of feature where they can successfully detect the IE version even if they are using IE 11 enterprise mode.
All responses are valuable. Appreciate your response !!!

As per MSDN:
As of Internet Explorer 11, the user-agent string has changed
significantly...Sites that rely on the user-agent string should be
updated to modern techniques, such as feature detection, adaptive
layout, and other modern practices.
https://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx
Although IE11 in EM throws
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; Tablet PC 2.0)
It is not advisable to just look for "MSIE" in the userAgent but rather try:
var isIE11 = !!navigator.userAgent.match(/Trident.*rv[ :]*11\./)

I'm just looking into this myself. I did stumble across this recently - but couldn't get it to work reliably - however the concept of looking for a feature of IE that shouldn't normally be available is sound.
My plan now is to use IETruth to get the version number (it's very good at doing version detection for IE11) and then do something like:
var IE = IeVersion();
if(IE.TrueVersion < 9 && ('spellcheck' in document.createElement('textarea')) {
// must be running in Enterprise mode because spellcheck wasn't introduced until IE10
}
I'll let you know how I get on!

You can use document mode to check for Enterprise mode. Because in EM the document mode is set to IE 5 to IE 8. This check along with your browser check functionality should work.
How to get browser "Document Mode"

Related

Why is the User-Agent of Opera mini printed strangely on iPad?

I print User-Agent string of Opera mini on iPad using JavaScript like below.
alert(navigator.userAgent);
Result is
Mozilla/5.0 (iPad; CPU OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77
I don't know how can I detect this browser that is Opera Mini.
Why is the User-Agent of Opera mini printed strangely on iPad?
Opera 16 runs with Webkit engine, hence the different user agent.
With Webkit it now support a lot of features the older version (using the Presto engine) didn't.
The reason they changed it, is most like to get by many web servers that will block the older Opera, where they often is spoofing the user agent, and when finding opera mini, block it as being outdated (and note, Microsoft did a similar trick with Windows phone)
...how can I detect this browser that is Opera Mini
Short answer, you can't
Longer answer, there are CSS features like -o-prefocus, media query hacks etc., many of them you can find here: http://browserhacks.com/
The downside with these, when that browser specific property disappears, so will your detection.
Instead, embrace the more future proof way and detect a feature, with e.g. #supports()
At this question there is some more interested reading with how-to using both CSS and script
Instead of using prefixes I want to ask site visitors to upgrade their browser

How can I look up my created webpages on internet explorer 8 or older? [duplicate]

This question already has answers here:
Software/tool to test/check web-application in multiple browsers?
(8 answers)
Closed 8 years ago.
I am using windows7 and it supports only internet explorer 9. I work on web pages designing on my chrome browser. But you know, some of the CSS features dnt support in Enternet Explorer 8 or erlier. But when I trying to download Internet explorer 8 to my Win7 OS it never downgrade IE from 9th to 8th. Then how can I look up my created web pages on IE8 ? Plz help
Do you have Developer tools? Then change the "Browser mode" and "Document Mode" to check the web page behaviour in lower versions .
You can use:
http://netrenderer.com/ to check all IE versions screenshoots
http://cloudinternetexplorer.com/ to check IE live (IE9 only)
https://browserling.com/ to check IE, Chrome, Firefox, Opera, Safari versions
http://www.browserstack.com/ is commercial, but have a free trial
http://crossbrowsertesting.com/ is commercial, but have a free trial too
etc...
EDIT: I recommend, if you are using CSS3, to use http://css3pie.com/ is a super htc app, that make major CSS3 function to work in IE.
Hope this will help you!
IETester allows you to run multiple versions of IE shells:
http://my-debugbar.com/wiki/IETester/HomePage

How to do Internet Explorer 7 testing and javascript debugging on windows 7?

I have windows 7 platform and I want to test my web application on Internet explorer 7. How can I do it ?
For this I have tried various solutions. I installed ieTester for the same. It is a good tool, but I cann't debug the javascript part in ieTester.
One of the stackoverflow post only Alert Box in IE Tester
Mark has mentioned that to use Firebug in ieTester, but I am unable to do that also.
I have also tried Microsoft expression superview in that also I havn't find any way to debug javascript.
Kindly help out in this issue.. My aim is to debug javascript on Internet Explorer 7 on windows 7 platform.
Any successful solution of this will be appreciated. Thanks in advance.
As said above ie9 will emulate ie7 - but it is not exactly ie7, i have seen numerous instances of real ie7 behaving differently to ie9. What i do for this is have a virtual pc image of vista with ie7 on it.
See here
Internet Explorer 9 has the option to view a website in IE7 mode & has a range of debugging tools. Just press F12 to open the developer tools.

Should I use IE9's "IE8 document mode" to debug IE8 support?

I'm developing a webapp with fairly complex DOM interactions.
Is IE9's "IE8 document mode" a reasonably good emulation of IE8 rendering?
Failing that, is Is there a way to have both IE8 and 9 on the same Windows 7 computer? I'll definitely test on 'normal' IE8 before release, but if I can work out most of the issues on my own dev machine, that'd be nice.
It is reasonably good, and it is pretty easy to use, so I would. But it is nevertheless a good idea to do a final check on IE8. You can install a program like IETester, that allows you to use multiple versions of IE, but it is not very stable and has some quirks too. The best thing would be to use a virtual machine for the different platforms and browsers you want to test on. You'll only need to do the testing on the VM after everything works in IE8 mode.
If you are using Windows 7, use the XP Mode to run IE 8. This allows you to run IE 9 in Windows 7 and IE 8 inside a XP virtual machine.

Strange User Agent With Google Chrome

I was working with some javascript and found a strange user agent with my Google Chrome.
I have Google Chrome 7.0.517.41 beta installed on my Ubuntu Laptop.
Now AFAIK my user agent should be something close to Chrome/7.0.517.41
but it is showing me:
Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7
Why is this happening.. I have disabled all the installed extensions but it is still the same..
The UA string tells the long and tragic history of (in)compatibility attempts. See e.g. this for a brief history of the UA. It should also make clear that UA sniffing is useless, as every modern browser pretends to be many other browsers. That is also the case you see here:
Mozilla - the most ancient artefact, dating from the early 1990s
X11 - the graphical interface used
Linux i686 - OS and processor type
en_US - your locale (English, United States)
AppleWebKit/534.7 - the actual rendering engine
(KHTML, like Gecko) - another artifact of browser sniffing: "Gecko" is the FF rendering engine, KHTML is an old rendering engine, predecessor of WebKit (was used by Konqueror browser, then forked by Apple to form WebKit)
Chrome/7.0.517.41 - the actual browser version
Safari/537 - yet another artifact against scripts sniffing for "Safari" (which uses the same engine)
In short: some broken sites assumed that "only allowing people with Mozilla/Firefox/Webkit/whatever" is a sensible policy; in turn, browsers started lying about their origins to get around these artificial barriers. The UA strings are the result: bloatware, full of useless garbage.
Basically, Mozilla stands for "Mozilla compatible" while "KHTML, like Gecko" describes the rendering engine.
Essentially, Chrome's user agent string is saying "I'm compatible with Mozilla and my rendering engine is like Gecko" as a way of describing itself to developers.
Most (if not every) browser will identify itself as Mozilla-compatible as a kind of legacy thing, regardless of affiliation with the Mozilla foundation. Yes, even Internet Explorer.
More info on strings in general at: Mozilla's developer center.
Also, if you're developing based on user agent strings, don't. You'll only find yourself in a world of hurt: browsers get upgraded to implement features and your user agent sniff might still exclude them, user agent strings can be spoofed, and good old Opera likes to report itself as Internet Explorer in older versions.
Instead, use feature detection to determine if a feature you're trying to use exists for a given browser and then use it or don't.
There are historical reasons for browsers "lying" about themselfs. The main reason for this was user agent sniffing. Opera is the only browser which identifies itself as Opera, all other browsers use Mozilla/5.0 or the older ones Mozilla/4.0.
The only thing you should know about this is: User agent strings cannot be trusted, feautre detection is recommended instead.
User agent strings are like that, as mentioned.
You haven't said that explictly, but if you are planning to use useragent string to detect the user's browser, please use some good code to do that (i.e. don't code it yourself in a hurry, you'll not get it right).
Here is a nice one that I've used a couple times before: Browser detect.
After trying everything I have finally used : http://www.useragentstring.com/
You can use the above website to get the formatted user agent and OS.
They have api which you can use directly...
hope it helps..!!!

Categories

Resources