iamnoah / writeCapture

Utility to assist the Ajax loading of HTML containing script tags that use document.write. Mailing List: http://groups.google.com/group/writecapturejs-users
http://iamnoah.github.com/writeCapture
Other
241 stars 38 forks source link

Problem with IE 6 and 7 #7

Closed jasper-ferrer closed 14 years ago

jasper-ferrer commented 14 years ago

The code below works on all major browsers and IE 8, but does not work on IE 6 and 7:

    writeCapture.proxyGetElementById = true;
    $("#placeHolder1").html( writeCapture.sanitize(
        "<script type=\"text/javascript\">\n" +
        "document.write(unescape(\'%3Cscript type=\"text/javascript\" src=\"\'+\n" +
        "document.location.protocol+\'//counter.goingup.com/js/tracker.js?st=xdxc7cr&b=5\"%3E%3C/script%3E\'));\n" +
        "</script>\n" ) );

The third party Javascript is a GoingUP tag. It creates an A element with id gubadge. On IE 6 and 7, this A element fails to be created.

iamnoah commented 14 years ago

Hi Jasper,

Can you add what version of writeCapture you are using?

Thanks

jasper-ferrer commented 14 years ago

Noah,

This is the file that I am using:

    writeCapture-0.9.0-nolib-min.js

I just saw that there is now a 1.0 relase. I'm gonna try that tomorrow then I'll let you know happens.

Thanks.

iamnoah commented 14 years ago

Hmmm, from the looks of the script, while it may render in other browsers, it wont work properly. It's setting onmouseover on the created link, which is not something writeCapture currently supports. I suppose we could copy the on- attributes from the proxy element...

iamnoah commented 14 years ago

Using the latest code, this appears to work in IE 6 & 7:

$('#placeHolder1').writeCapture('html','<script type="text/javascript" src="http://counter.goingup.com/js/tracker.js?st=xdxc7cr&b=5\"> </script>')

Although, like I said, the onmouseover callback is certainly not attached.

iamnoah commented 14 years ago

I've added some code to try to copy the element attributes if jQuery is available (setting attributes is non-trivial).

jasper-ferrer commented 14 years ago

Thank you very much Noah.

Grabbed the latest release (writeCapture-1.0.0-nolib-min.js) and I can confirm that GoingUP tag is now supported by writeCapture.

jasper-ferrer commented 14 years ago

Correction, in my last post what I was referring to as the latest release is this: jquery.writeCapture-1.0.0-min.js.

iamnoah commented 14 years ago

Thanks!