最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How does IE11 populate window.location.origin? - Stack Overflow

programmeradmin3浏览0评论

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 =

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?

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.

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?

Share Improve this question edited Mar 15, 2021 at 15:16 lissettdm 13.1k1 gold badge23 silver badges42 bronze badges asked Sep 22, 2015 at 16:25 UsainBlootUsainBloot 8166 silver badges20 bronze badges 9
  • What is the value of window.location.href in the test environment? – Barmar Commented Sep 22, 2015 at 16:39
  • window.location.href in the test environment is the same as the URL at the top. I'm just wondering how IE11 obtains the origin as its undefined in the test env and http://www.myproductionwebsite. in production. Maybe it uses DNS? – UsainBloot Commented Sep 22, 2015 at 16:45
  • I don't see why it would use anything other than just copying the beginning of the URL in .href. DNS doesn't have information about URLs. – Barmar Commented Sep 22, 2015 at 16:47
  • Hmmm its really strange, its not causing me an issue as I can work around it, just curious. – UsainBloot Commented Sep 22, 2015 at 16:49
  • 2 Are you still facing this issue? Could this bug be related to it? connect.microsoft./IE/feedback/details/1763802/… – William Commented Feb 14, 2016 at 17:18
 |  Show 4 more ments

1 Answer 1

Reset to default 7

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.

References

  • [MS-IEDOCO]: Internet Explorer Standards Support Documentation Overview, 2.1.3.6 Compatibility View

  • The Intranet Zone

发布评论

评论列表(0)

  1. 暂无评论