Jump to content

Removing HTML code from webpage before loading


petenyc1
 Share

Recommended Posts

Our radiology web viewer has a very annoying "feature" that if you are running IE above version 6 it will warn you with a popup window. You can click OK and all works good but this is annoying. I would like to remove the check from the HTML but with the IECreate the page loads and the warning message pops up.

$oIE = _IECreate("http://cintegrad.ehmc.com",0,1,0)

$webpage = _IEDocReadHTML ($oIE)

$webpage=StringReplace($webpage,"checkBrowser();","")

_IEDocWriteHTML($oIE, $webpage)
_IEAction ($oIE, "refresh")

If I do OK through the warning message and then View Source the HTML is being changed. If I refresh the page it actually works perfectly (no warning message). I tried _INetGetSource however if the webpage name is different the image references fail on the page.

Thank you in advance. I really did try and go through the forums and figure this out myself but I do have my flame retardent suit on just incase!

Peter

Link to comment
Share on other sites

Sounds like an out-of-date app. Who maintains the web viewer site? This would be much easier to fix on the server side.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Assuming the alert is displayed as part of a body onload event handler, if you wait for the document to load you cannot prevent the popup. I would suggest simply trying to dismiss the popup quickly with WinWait and ControlSend.

If you want to mess around a bit, you can use _IECreate with $f_wait set to 0 and then loop checking the readystate with _IEPropertyGet... when it hits 3 (interactive) you MIGHT be able to inject javascript that would redefine the alert function to be a noop in time.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

@MPH - ah yes, good call... forgot about that. This would require Greasemonkey be installed and configured in each browser that was to use this, however...

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...