Can't assign relative path to image source in Javascript after applying KB4486474 to IE11

问题: I have code that has worked for years without any issue until Microsoft's latest Cumulative Security Update came out this February. When KB4486474 is installed for IE11 (Ve...

问题:

I have code that has worked for years without any issue until Microsoft's latest Cumulative Security Update came out this February. When KB4486474 is installed for IE11 (Version 11.590.17134.0, Update Versions: 11.0.110), the following line now throws an "Access Is Denied" error.

o.src = "/img/menuTick.png";

Variable "o" is an IMG element. This only seems to affect assignments to the src property of an IMG element as far as I can see. The only way I've found to get around this is assigning the full URL.

o.src = "http://mywebsite.com/img/menuTick.png";

or:

var l = window.location;
o.src = l.href.replace(l.pathname, "/img/menuTick.png");

If I uninstall the KB4486474 update for IE11, the original code works fine again.

Has anyone else come across this issue, and if so, is there any way around this as I literally have thousands of assignments to relative paths in the code, and don't want to have to replace with the above fix for every one of them?


回答1:

o.src = "imgmenuTick.png";

or

o.src = l.href.replace(l.pathname, "imgmenuTick.png");

  • 发表于 2019-02-22 05:28
  • 阅读 ( 630 )
  • 分类:sof

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除