[p2pu-dev] plugins.js and document.write()

Dirk Uys dirk at p2pu.org
Tue Aug 7 20:16:44 UTC 2012


Hoping not too much. Had a look at all the other js code we are using, and
it doesn't seem like there is a lot of places where document.write is being
used.

Thanks for the feedback!

Cheers
d

On Tue, Aug 7, 2012 at 7:31 PM, Paul Osman <paul at eval.ca> wrote:

> Yes. Love it when you include a lib and "surprise! JavaScript works
> differently now!"
>
> Wonder how much a pain it'd be to update ?
>
>
> On 2012-08-07, at 1:27 PM, Dan Diebolt <dandiebolt at gmail.com> wrote:
>
> That's a clever idea: monkey patch a built in JavaScript method (eg
> document.write() ) so only some 3rd party scripts can continue to use the
> method. This could not possible have been intended to be in production so
> it is no surprise it is removed.
>
> On Tue, Aug 7, 2012 at 1:07 PM, Paul Osman <paul at eval.ca> wrote:
>
>>  Looks like it's a security thing. You're meant to replace
>> 'docwriteregexwhitelist' with a regular expression that allows specific 3rd
>> party scripts to use document.write(). Take a look at the following issue
>> filed by someone who was similarly confused:
>>
>> https://github.com/h5bp/html5-boilerplate/issues/150
>>
>> Interestingly, recent versions of boilerplate don't include this.
>>
>> Cheers,
>> -P
>>
>> On Tuesday, 7 August, 2012 at 6:52 AM, Dan Diebolt wrote:
>>
>> I think the code serves as a debugging aid to intercept document.write
>> calls and store them in the array log.history as well as echo to
>> console.log. I don't think the code was intended for inclusion in
>> production.
>>
>> On Tue, Aug 7, 2012 at 4:23 AM, Dirk Uys <dirk at p2pu.org> wrote:
>>
>> Hi everyone, Paul, Zuzel
>>
>> After some focused debugging on why conversion tracking isn't working
>> (Iow, after I verified a 100 times that the code is correct and accepted
>> that it still doesn't work) I found the problem or at least what I think is
>> the problem:
>>
>> It seems like in plugins.js (
>> https://github.com/p2pu/lernanta/blob/master/lernanta/static/js/plugins.js#L47)
>> essentially disables document.write().  Except if you want to write
>> "docwriteregexwhitelist". It looks like this comes from HTML 5 Boilerplate?
>> What was the reasoning behind this - is this to stop other JavaScript from
>> doing bad things? Doesn't embed.ly already do this? Or do we allow
>> script tags in the rich text editor?
>>
>> I would like to get conversion tracking to work on the site, so can I
>> safely remove this bit of code?
>>
>> Cheers
>> Dirk
>>
>> _______________________________________________
>> p2pu-dev mailing list
>> p2pu-dev at lists.p2pu.org
>> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>>
>>
>> _______________________________________________
>> p2pu-dev mailing list
>> p2pu-dev at lists.p2pu.org
>> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>>
>>
>>
>> _______________________________________________
>> p2pu-dev mailing list
>> p2pu-dev at lists.p2pu.org
>> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>>
>>
> _______________________________________________
> p2pu-dev mailing list
> p2pu-dev at lists.p2pu.org
> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>
>
> _______________________________________________
> p2pu-dev mailing list
> p2pu-dev at lists.p2pu.org
> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p2pu.org/pipermail/p2pu-dev/attachments/20120807/67d939bc/attachment.html>


More information about the p2pu-dev mailing list