In JavaScript, document.documentMode maps to the F12 Developer Tools. The user agent is not affected:
Do:
Use the following detection methods to detect the source of errors more reliably and to make sure that your webpages are compatible across browsers:
Feature detection: Test whether a browser supports a feature before you use it. Feature detection enables cross-browser code to "just work" without requiring you to know the capabilities of every browser ahead of time. For example, the jQuery framework relies almost entirely on feature detection. For more info about how you can use jQuery's feature detection in your own site, see the jQuery.support documentation.
Behavior detection: Test for known issues before you apply a workaround. jQuery also uses behavior detection by running tests for known issues to determine if certain workarounds are needed.
Don't:
Detect specific browsers: Don't use the identity of a browser (for example, navigator.userAgent) to change a page's behavior. If you change code based on a specific browser, the page cannot easily adapt to changes and it might break when a new browser is released. In other situations, pages use a legacy workaround even when that workaround is no longer needed.
Assume unrelated features: Don't perform feature detection for one feature and then use a different feature. Sites that have this problem perform feature detection for one feature and then use other features without testing whether they are supported.
References
navigator.userAgent. we notice that in the network tab. both were different, console output displayed the "appropriate" user-agent string. though the network tab only reflected the change of thedocument mode... - culturalanomoly