views:

189

answers:

1

I want to force external 3rd party scripts (on seperate domains) to use my own custom implementation of document.write when I load them on my domain.

ie:

document.write = function(args) {
    // My custom Function
    }

This works fine for scripts on the same domain, but scripts on other domains use the browser default. Can I override this?

A: 

Here you are:

(window.HTMLDocument ? HTMLDocument.prototype : document).write = function(s) {
    this.title = s;
}

Both in IE and in non-IE, "this" object is the browser document object.

Sergey Ilinsky
That doesn't make a bit of difference :(
FlySwat
Thank you guys for minusing my help, however I am not going to withdraw my right answer. Anyway, I tested what I proposed and it indeed works. You can see it working: http://www.amplesdk.com/share/test.html
Sergey Ilinsky