Jump to content

[Solved] Preventing a new IE window from opening


intime69
 Share

Recommended Posts

Hi,

I am fairly new to the forum. I know that this topic has been dealt with previously but there has never been a clear answer regarding this. As the title says, I am trying to prevent IE from opening when a New Window is called via a link while running an Embedded IE Object.

Preventing IE from opening seems to be a fairly difficult task... I am therefore offering $50 US to whom ever can figure this out. You must submit a working AutoIT Script that will show an Embedded IE Object opening a New Window (within the Embedded IE Object) without Internet Explorer opening.

If several solutions are submitted, I will pick out the best one and the winner will get $50 US in their Paypal Account.

Thanking in advance anybody that can help. It would be greatly appreciated!

Ian, Developer and Co-owner

InTime Application Inc.

P.S.: I want the best solution possible so VIP's, Moderators and Admins are allowed to participate. If you think that this can't be done, think harder. I am sure that there is a way to achieve this! AutoIT can almost do miracles. It's an awesome tool!

Edited by intime69

Developer and Co-OwnerInTime Applicaitons Inc.

Link to comment
Share on other sites

#include <IE.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
GUICreate("Embedded Web control Test", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

GUISetState()       ;Show GUI


_IENavigate ($oIE, "http://google.com")

is it ??????

Edited by thanh159
Link to comment
Share on other sites

is it ??????

Thanks... but not quite. I know how to do the embedded IE object. On some websites, certain links will open a new tab or a new window. I want this new windows to be contained within the "Embedded IE Browser". In other words, I don't want these links to open a new IE window. Worst case, it should open a new "Embedded IE Browser" window and not IE itself. So it's the 'New Window Event' http://msdn.microsoft.com/en-us/library/aa768335.aspx that I am trying to capture.

I hope that I have explained this correctly. It's kinda difficult to put into words...

Developer and Co-OwnerInTime Applicaitons Inc.

Link to comment
Share on other sites

You'll need to either modify the HTML in the initial window to change the target= attribute of the link before it is clicked on, or inject javascript into the page that traps the newwindow event (autoit ObjEvent cannot be used to modify the behaviour of an event, only to be notified of it). The solution will be unique to each page you are trying to control, so there is no "general" solution.

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

can't he somehow activate IE's Popup Blocker feature, on an instance basis?

If he looks in the documentation, maybe Mirosoft exposed it.

(tho I am not sure it will be on an instance basis.. probably on a general one - affecting IE generally on that computer).

Link to comment
Share on other sites

You'll need to either modify the HTML in the initial window to change the target= attribute of the link before it is clicked on, or inject javascript into the page that traps the newwindow event (autoit ObjEvent cannot be used to modify the behaviour of an event, only to be notified of it). The solution will be unique to each page you are trying to control, so there is no "general" solution.

Dale

Thanks Dale!

I think I have a way to do this. It involves grabbing the IE address as a NewWindow is created and killing the IE process. This can be done instantly without showing the IE window but it uses 3 to 5% more CPU compared to using a delayed technique where the IE window pops up for about a second before the process is killed. In kiosk mode where the GUI is set to always active, killing the IE process is optional but after closing the GUI, a few IE windows might be open. So killing IE as it pops up is a better option but will prevent the user from using IE all to getter. And that is where Firefox or Opera might come in handy! lol

If you have anymore ideas, please don't hesitate to let me know...

Ian

Edited by intime69

Developer and Co-OwnerInTime Applicaitons Inc.

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...