I am automating a website.

There is this one part where once in a while a page is not published. If I want to move on and navigate away, a javascript pops out show up asking whether I am sure that I want to navigate away because the there is some unsaved change.

Well, I did (dw1 is htmldocument of the object)

dw1.body.innerhtml=""
dw1.scripts(0).outerrhtml=""
dw1.scripts(0).outerrhtml=""

Now, if I view the source, the source is still exactly the same.

however, if I do ?dw1.all(0).outerhtml, I see that all the scripts have been removed.

However, if I close the internet explorer the same annoying pop up message still show up.

How do I get rid javascript in that page?