Sign in to follow this  
Followers 0
Shyke

IE Navigation and Javascript

7 posts in this topic

The code that I have included perfectly reproduces my issue. How can I stop window.close() from killing my embedded window or even giving me an option for it to close?

GUICreate("Reproducer", 300, 80)
$oIE = ObjCreate("Shell.Explorer.2")
GUICtrlCreateObj($oIE, 0, 0, 300, 80)
GUISetState()
FileWrite("reproducer.html", '<body onload="window.close();">How can I stop this window from closing?</body>')
$oIE.navigate(@WorkingDir & "\reproducer.html")
Do
    If GUIGetMsg() = -3 Then
        FileDelete("reproducer.html")
        Exit
    EndIf
Until 0

Share this post


Link to post
Share on other sites



You'd need to get the file source with INetGetSource or XMLHttpRequest (or FilreRead if it is really local), parse and manipulate the string and then write it to a file and open it with the browser or write it to an about:blank document.

The onload action is going to execute before you have a chance to intervene with normal browser interaction.

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

Share this post


Link to post
Share on other sites

And if that window.close() is a result of a POST?

Share this post


Link to post
Share on other sites

Bump for additional input.

Share this post


Link to post
Share on other sites

Are you trying to come up with passive way to prevent this or do you know when it is going to happen?

Please share a more complete description of what your environment is and what you are trying to accomplish. I don't like trying to help and being spoon-fed information.

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

Share this post


Link to post
Share on other sites

I'm doing a POST command and it leads me to a site like as described in the reproducer, sort of a return page from a pop-up window.

This happens whenever I do that POST command and the window.close is the return page from it. I just need a way to disable it once, I was thinking registry disabling of Javascript.

Share this post


Link to post
Share on other sites

If Javascript is enabled you will always be probped to allow the close - it is a security feature.

You can control the setting in the registry. Pay attention to insure you get the right security zone based on where your page is comming from:

Javascript OFF:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre ntVersion\InternetSettings\Zones\0]

"1400"=dword:00000003

Javascript ON:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings\Zones\0]

"1400"=dword:00000000

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0