Jump to content

Intercept link click from _IECreateEmbedded


Recommended Posts

I don't really see a way in the IE UDF to intercept link clicks from an Embedded IE. Can someone point me in the right direction?

My Goal would be to intercept the click, and open it with the Default browser instead... :(

Thanks. >_<

Edited by BinaryBrother

SIGNATURE_0X800007D NOT FOUND

Link to comment
Share on other sites

You confuse me because the code you place above has nothing to do with HTML links.

If I just pay attention to your question, the answer is simple:

#include <IE.au3>

$oIE = _IECreate("www.yahoo.com")

$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    ; _blank opens a new browser
    $oLink.target = "_blank"
Next

Dale

Edited by DaleHohm

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

Two part question. >_< -- Scratch the second question, it has been removed.

I don't really see a way in the IE UDF to intercept link clicks from an Embedded IE. Can someone point me in the right direction?

My Goal would be to intercept the click, and open it with the Default browser instead... :(

Thinking it over Dale, I don't really think the question is directed towards you. I know the IE UDF doesn't have a function to do this, because the IE UDF is exactly that, and not a "Default Browser" UDF... hehe

But any ideas on how this could be done, if at all?

Detailed Info:

I use _IECreateEmbedded() in a basic scenario to embed RandomSite.com, only when the user clicks a link, it will ShellExecute() that link, rather than open a new IE window...

So intercept is a really strong keyword in my initial question. :(

Edited by BinaryBrother

SIGNATURE_0X800007D NOT FOUND

Link to comment
Share on other sites

If Dale's suggestion doesn't work for you, what if you used a while loop with _IEPropertyGet($oIE, "locationurl") to see if it ever changes. If it does, you can instantly navigate the embedded browser back and use ShellExecute() like you were saying with the new url you just grabbed.

Link to comment
Share on other sites

Thanks for the suggestion Sticky. The way I'm using _IECreateEmbedded() is inside an Ajax chat. All the links are already coded when they are posted to open in a new window... That new Window is a full fledged IE window which breaks out of my standard embed. Which means... The only real way I see of doing it would be to watch for a new IE window, nab the attempted URL, kill IE, and throw that URL into a ShellExecute()... Which I'm not going to do because it's unethical... lol. There are some users who would actually like IE Functionality while using my application, and nabbing any IE window that opens, and throwing it into FireFox, isn't going to be pretty... :D

I would post the source, but it's the same thing as in the help file, and it's on a site that is paid membership only, so a reproducer isn't possible.

_IECreateEmbedded() is used in an environment in which the page will remain static (Chat interface) and all links are opening in a new window anyway. Its complicated... I'm really trying with other languages, VB.NET and C#... but it's just so hard to grasp... :D C++ seamed easier than VB.NET!

SIGNATURE_0X800007D NOT FOUND

Link to comment
Share on other sites

It's doable - I've done what is necessary in a complex production application. But it is complex and involves 1) dynamically embedding script, 2) adding an onclick handler to the links, 3) using the onclick handler to update a hidden form field 4) with an onchange event handler that 5) triggers an ObjEvent trigger in AutoIt that 6) launches your browser. It has to be really inportant to you.

Dale

Edited by DaleHohm

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

The only problem is, the Java chat is loading an XML file, which is then read to chat... I'll probably use your idea, and just tell Java to look for the XML locally (if that's possible) and just download the XML file once a second like Java does. The only thing that bugs me is, while using _InetGetSource(), IECreateEmbedded() seems to totally lock up... I verified that with a large file. I'm assuming this is normal... I had to change an Adlib Event to once a min, rather than once every 5 seconds because of that. That is fine now, so I may try and use your idea. It really doesn't seam that hard... :D

Quite brilliant actually... Thanks. :D

SIGNATURE_0X800007D NOT FOUND

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