Jump to content

_IECreateEmbedded () and New IE Windows


litlmike
 Share

Recommended Posts

I would like to Embed an IE window in a GUI, and when the user clicks on a link that normally would open a new IE window, just have the current IE navigate to that new page. Is that possible?

As a side question, are the forums laggy for everyone else right now?

If you need my code, just let me know, but I don't think that would necessary in this case, since we are not debugging a script, we are asking about the functionality of _IECreateEmbedded ().

Thanks in Advance.

Link to comment
Share on other sites

Yes, it is possible to navigate the embedded IE object like you want. You just need to set an object's event (your "link") to _IENavigate your embedded IE object.

And yes, the forums are super laggy right now for me as well.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Yes, it is possible to navigate the embedded IE object like you want. You just need to set an object's event (your "link") to _IENavigate your embedded IE object.

And yes, the forums are super laggy right now for me as well.

Thanks for the feedback. Does this assume you already know the link the user is going to click on? If so, then can I make this work for all links? So that, it can be any link the user ever clicks?
Link to comment
Share on other sites

Ah, sorry, miscommunication there. What I was referring to was navigating the embedded object from outside the embedded object, but within the GUI. If you want to navigate from a link on a page inside the embedded object, you simply have to click on it. Hope that helps.

Edit: (Now that I've completely read your title/post...lol) I'm not sure about how links that force the opening of a new window will work in an embedded object, off the top of my head I would think you would run into trouble, and could maybe solve it by removing the command to open the link in a new window from the source?

Edited by mikehunt114
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Ah, sorry, miscommunication there. What I was referring to was navigating the embedded object from outside the embedded object, but within the GUI. If you want to navigate from a link on a page inside the embedded object, you simply have to click on it. Hope that helps.

Edit: (Now that I've completely read your title/post...lol) I'm not sure about how links that force the opening of a new window will work in an embedded object, off the top of my head I would think you would run into trouble, and could maybe solve it by removing the command to open the link in a new window from the source?

Ha! That's funny.

Yes I am for sure running into trouble with this, and if there is a way to remove this command, I certainly have no idea where to begin. Anyone have any guesses?

Link to comment
Share on other sites

Can you post the url?

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Ok. If I'm understanding correctly and you want to prevent each and every link from ever opening the link a new window, I think you'd have to _IEDocReadHTML every source containing a link, and remove the "target=" section. You'd have to set up a loop that checks every part of the page for links and then adjust each source accordingly. Do these links not work in an embedded IE object? Sorry, I have never used the embedded IE. It sounds rather cumbersome to avoid them, given that you don't know where the user is browsing. I could be missing something here.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

New windows can get opened in several ways. The simplest case is with target= in the link definition as Mike suggests. You can manipulate those by rewriting the link, perhaps like this:

$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    If StringLen(String($oLink.target)) Then
        $oLink.target = "_top"
    EndIf
Next

New windows can also be created with Javascript and element events... this is much more involved to anticipate.

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

Hi Dale,

So how does an embedded IE object react when a new window or pop-up is trying to be opened? I understand why and how it can happen, but what is the result? Is it just disregared/null?

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

I have not tested, but I expect it to open a new "unembedded" browser window.

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

Yeah, I played around for a couple minutes with an embedded IE object and that's precisely what it did. So it doesn't really cause any issues, it can be contained within the embedded object. (I tested a page with a link having a target of a new window and managed to contain it to the embedded IE)

Learned something again today. Wewt.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Ok. If I'm understanding correctly and you want to prevent each and every link from ever opening the link a new window, I think you'd have to _IEDocReadHTML every source containing a link, and remove the "target=" section. You'd have to set up a loop that checks every part of the page for links and then adjust each source accordingly. Do these links not work in an embedded IE object? Sorry, I have never used the embedded IE. It sounds rather cumbersome to avoid them, given that you don't know where the user is browsing. I could be missing something here.

That is an interesting idea. I was hoping that this would be a simple parameter switch from 0 to 1.

Along your thinking, it seems that we would have to detect every new page load, then re-write the HTML. That sound about right?

Link to comment
Share on other sites

Yes, I've written a couple of examples posted in the forums. Look for ObjEvent and Navigate

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

Dale - I played around with the onload event yesterday, but never could get it to fire with the embedded browser.

Ah yes, it is the onload event, not navigate.

If you start the _IECreateEmbedded example the following works for me:

#include <IE.au3>
    
$sTitle = "Embedded Web control Test"
$oIE = _IEAttach ($sTitle, "embedded")
    
; Set up an event sink so that we can trigger on page loads
$oEvent = ObjEvent($oIE, "Evt_")
    
; The inital page load is already done... refresh so that event fires
_IEAction($oIE, "refresh")
    
; Exit is the window closes
While WinExists($sTitle)
    Sleep(500)
WEnd
    
Exit
    
Func Evt_onload()
    ; This function will be fired whenever a new help page loads
    ConsoleWrite("I'm in..." & @CR)
EndFunc   ;==>Evt_onload

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