Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does IE11 populate window.location.origin?

I have an issue in a non production environment in Internet Explorer 11 where

window.location.origin is undefined.

However, in the production environment this value actually returns

window.location.origin = http://www.myproductionwebsite.com

This issue only exists in Internet Explorer and works fine in Chrome and Firefox across production and non production environments, which has lead me to believe its the way that the Chakra JavaScript Engine in IE11 populates origin.

I have also looked at the request and response headers across production and non production environment and all the parameters are identical.

How does Internet Explorer 11 calculate window.location.origin differently to Chrome or Firefox?

like image 666
UsainBloot Avatar asked Sep 22 '15 16:09

UsainBloot


People also ask

What does Window location Origin return?

Definition and Usage The origin property returns the protocol, hostname and port number of a URL.

What is location origin?

The DOM Location origin Property in HTML is used to return the protocol, hostname and port number of a URL. This is a read-only property. Syntax: location.origin. Return Value: This method returns a String value representing the protocol, the domain name (or IP address) and port number.

What is window origin?

Window is first recorded in the early 13th century, and originally referred to an unglazed hole in a roof. Window replaced the Old English eagþyrl, which literally means 'eye-hole', and eagduru 'eye-door'.

What is window location href?

Window Location Href The window.location.href property returns the URL of the current page.


Video Answer


1 Answers

Intranet sites are set to Compatibility View, which disables window.location.origin:

Pages will run in Compatibility View unless they explicitly specify another document mode. This option can be disabled using the Tools > Compatibility View Settings menu.

Sites are placed in the Intranet Zone based on the following criteria:

Direct Mapping. As with other Zones, users or network admins may map a list of URL patterns into the Local Intranet Zone. This list is viewable by clicking Tools > Internet Options > Security > Local Intranet > Sites > Advanced.

The PlainHostName rule (aka “The Dot rule”). If the URI’s hostname doesn’t contain any periods (e.g. http://team/) then it is mapped to the Local Intranet Zone.

The fixed Proxy Bypass list. If the user has a fixed proxy specified inside Tools > Internet Options > Connections > LAN Settings, then sites listed to bypass that proxy will be mapped to the Local Intranet zone. The fixed proxy bypass list can be found by clicking the Advanced button; it’s at the bottom of the screen in the box labeled Exceptions.

(WPAD) Proxy Script. If the user’s proxy configuration is “Automatically detect settings” or “Use automatic configuration script” inside Tools > Internet Options > Connections > LAN Settings, the browser will run the FindProxyForUrl function in the specified WPAD proxy configuration script to determine which proxy should be used for each request. If the script returns “DIRECT”, the browser will bypass the proxy and the site will be mapped into the Local Intranet Zone. When mapping a URL to a Zone, URLMon will call the FindProxyForUrl function to determine if the bypass rule applies. One interesting twist is that the proxy script may itself call dnsResolve to get a site’s IP address and use that information as a part of its determination.

Full-sized flowchart detailing how document modes are chosen in IE11

References

like image 158
Paul Sweatte Avatar answered Oct 13 '22 17:10

Paul Sweatte