首页 > Windows开发 > 详细

fixed window.location.origin useless in IE

时间:2015-05-15 22:47:37      阅读:363      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!