IE突然不允许跨站点document.write?

发布于 2024-10-04 21:36:38 字数 928 浏览 0 评论 0原文

我们的网站有几个附属机构,它们使用 JavaScript 小部件来显示广告空间中可用的最新内容。这一切都是由 JavaScript 驱动的。将脚本插入到正确的位置,我们的 Rails 应用程序会生成一些 rhtml 来插入。周三,这在 IE 中突然停止工作。除了 IE 之外,其他所有浏览器都可以正常显示代码。有人可以指出我如何解决这个问题的方向吗?

这是有问题的代码:

document.write('<div id="std-widget" style="width:300px;height:250px;text-align:center;border-style:none;">');
document.write('<a href="<%= @hrefPath %>" target="_blank">')
<% if @deal %>
  document.write('<img src="<%= @imagePath %>" style="border-style:none;" alt="Today\'s Deal in <%= @affiliate.market.name %> - <%= @deal.subject.gsub("'","\\\\'") %>" />');
<% else %>
  document.write('<img src="<%= @imagePath %>" style="border-style:none;" alt="Sign Up Today for Great Deals in <%= @affiliate.market.name %>" />');
<% end %>
document.write('</a>');
document.write('</div>');

IE 突然不喜欢其中的某些内容吗?谢谢!

Our site has several affiliates that use a JavaScript widget to display the latest content available in an ad space. It's all JavaScript powered. The insert the script in the right place, and our rails app generates some rhtml to get inserted. On Wednesday, this suddenly stopped working in IE. Every other browser displays the code just fine, except IE. Could someone point me in a direction on how to resolve this?

Here is the offending code:

document.write('<div id="std-widget" style="width:300px;height:250px;text-align:center;border-style:none;">');
document.write('<a href="<%= @hrefPath %>" target="_blank">')
<% if @deal %>
  document.write('<img src="<%= @imagePath %>" style="border-style:none;" alt="Today\'s Deal in <%= @affiliate.market.name %> - <%= @deal.subject.gsub("'","\\\\'") %>" />');
<% else %>
  document.write('<img src="<%= @imagePath %>" style="border-style:none;" alt="Sign Up Today for Great Deals in <%= @affiliate.market.name %>" />');
<% end %>
document.write('</a>');
document.write('</div>');

Is there something in there that IE suddenly dislikes? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文