这让我很头疼,整天都在追它。我们有一个广告服务器,它调用我们网站上的脚本,然后插入代码。
例如,在 iframe 中调用的 Adserver 页面:
<html>
<head><title></title></head>
<body>
<script src="http://adserver/ad?s=728x90"></script>
</body>
</html>
上面的脚本调用返回的 javascript:
document.write('<script type=\'text/javascript\' src=\'http://partner.googleadservices.com/gampad/google_service.js\'>\n');
document.write('</script>\n');
document.write('<script type=\'text/javascript\'>\n');
document.write('GS_googleAddAdSenseService("ca-pub-xxxxxxxxxxxxxxxxxxx");\n');
document.write('GS_googleEnableAllServices();\n');
document.write('</script>\n');
document.write('<script type=\'text/javascript\'>\n');
document.write('GA_googleUseIframeRendering();\n');
document.write('</script>\n');
document.write('\n');
document.write('<script type=\'text/javascript\'>\n');
document.write('GA_googleFillSlotWithSize("ca-pub-xxxxxxxxxxxxxxxxxx", "Global_728x90", 728, 90);\n');
document.write('</script>\n');
这会将 Google Ad Manager 广告插入我们的页面。问题是代码在 IE 7 和 8 中不起作用,但在 Chrome、Firefox、Safari 等中运行良好。
IE 返回的“错误”是“Object Expected”,通过 IE 的“开发者工具”运行它也无济于事。
我已经尝试了很多事情来让它工作,拆分
似乎每当运行 GS_ 或 GA_ 函数时都会发生错误,所以我怀疑 IE 试图阻止外部脚本写入页面?
任何人都可以阐明为什么会发生错误或解决方案吗?
谢谢