2

For some reason, it seems like IE9 (I believe IE8 too, but not sure), is injecting

<SCRIPT LANGUAGE=VBScript>on error resume next pluginFound = IsObject(CreateObject("DIFFERENT PLUGIN EVERY TIME"))

in the middle of my content without any regards to surrounding context. This means it gets added in the middle of an attribute, or in the middle of some JavaScript, causing the HTML to be malformed and causing all sorts of problems.

This happens on multiple computers with different plugins, so it's not machine specific. And it's also not consistent: the location in which the offending script gets injected varies, the offending script varies. Sometimes you'll get several page loads without a problem and then you'll get the broken HTML.

Developer Tools

My page is using a fair amount of JS, but nothing crazy. It's currently using jQuery, Google Maps, Bootstrap, Google Tag Manager, and loading a couple of Twitter, Google+, Facebook Iframes with their own little JS snippets. So, there are some asynchronous callbacks happening, but I wouldn't think this would interfere with how the browser renders the DOM and when it decides to inject plugin code.

You can see the problem if you reload http://www.rew.ca/properties/search/839721 enough times. If you scroll to the bottom of the page, you'll see raw JSON, or sometimes just some random HTML snippet will show in the middle of the page (because of mismatched tags).

Any ideas of why these scripts get injected arbitrarily and how to work around that?

Thanks

[UPDATE] Here's another example of the script tags getting included in the middle of HTML content: enter image description here

4

1 回答 1

3

在我看来,问题出在http://cn.clickable.net/js/cct.js脚本上,具体IsIEPlugin出在类的方法上__cct_tracker

this.IsIEPlugin = function (e) {
  var t = !1;
  return document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n pluginFound = IsObject(CreateObject("' + e + '")) </SCR' + "IPT>\n"), t ? 1 : 0
}

这个方法被多次调用,使用不同的参数:

this.pixelRequestParams.cctDir = this.IsIEPlugin("SWCtl.SWCtl.1"),
this.pixelRequestParams.cctFlashPlugin = this.IsIEPlugin("ShockwaveFlash.ShockwaveFlash.1");
if (this.IsIEPlugin("PDF.PdfCtrl.1") == 1 || 
    this.IsIEPlugin("PDF.PdfCtrl.5") == 1 || 
    this.IsIEPlugin("PDF.PdfCtrl.6") == 1) 
  this.pixelRequestParams.cctPdf = 1;
this.pixelRequestParams.cctQuickTime  = this.IsIEPlugin("Quicktime.Quicktime"),
this.pixelRequestParams.cctRealPlayer = this.IsIEPlugin("rmocx.RealPlayer G2 Control.1"), 
this.pixelRequestParams.cctWmPlayer   = this.IsIEPlugin("wmplayer.ocx")

我想(即使我不确定)“cct”代表“可点击转化跟踪”,所以它一定是某种跟踪代码。
经过进一步调查,我确定“cct.js”脚本由Google 跟踪代码管理器(GTM) 脚本http://www.googletagmanager.com/gtm.js加载。
因此,如果我没记错的话,通过从您的 HTML 页面中删除 GTM 代码段,您应该能够解决问题。
GTM JavaScript 代码动态注入的 VBSCRIPT 代码似乎有时没有执行,但不要问我为什么,因为我真的不知道。

于 2012-12-18T21:04:30.747 回答