码迷,mamicode.com
首页 > Windows程序 > 详细

fixed window.location.origin useless in IE

时间:2015-05-15 22:49:14      阅读:573      评论:0      收藏:0      [点我收藏+]

标签:

Today I got a issue that window.location.origin returns undefined in IE 9 .

But we can fix this issue with following code:

if (!window.location.origin) {
  window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ‘:‘ + window.location.port: ‘‘);
}

 

and now the window.location.origin will return what we expect

fixed window.location.origin useless in IE

标签:

原文地址:http://www.cnblogs.com/deryck/p/4506937.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!