Jump to content



Photo

Open IE page on a different webbrowser


  • Please log in to reply
1 reply to this topic

#1 tiosha

tiosha

    Seeker

  • Active Members
  • 25 posts

Posted 03 July 2012 - 05:27 PM

Hi guys
I've been searching for this but I couldnt find it

I have 2 browsers on my GUI (wb1 and wb2)

when I click on a button (btn1) a page loads on wb1. Then I want to click a link on the page that loaded on wb1 and I want that page to open on wb2.

How can I make that?

thanks in advanced





#2 MrMitchell

MrMitchell

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 747 posts

Posted 03 July 2012 - 09:36 PM

IE Fires a BeforeNavigate2() Event before it's about to navigate to a new page. Unfortunately it looks like AutoIt isn't able to cancel navigation by setting $cancel = True...there are a few [older] threads in the forums about this. I've come up with this, kind of works:

#include <IE.au3> Dim $wb1 = _IECreate("<a href='http://www.google.com' class='bbc_url' title='External link' rel='nofollow external'>http://www.google.com"</a>) Dim $wb1Events = ObjEvent($wb1, "_IEEvent_", "DWebBrowserEvents2") While 1     Sleep(100) WEnd Func _IEEvent_BeforeNavigate2($IEpDisp, $IEURL, $IEFlags, $IETargetFrameName, $IEPostData, $IEHeaders, $IECancel)     ;Use IEURL to open the link in wb2     ConsoleWrite("BeforeNavigate2 Fired - Navigate to: " & $IEURL & @CRLF)     $wb1.Stop EndFunc   ;==>_IEEvent_BeforeNavigate2


Basically it listens for the event on wb1 and immediately stops the action. It also places the intended destination URL in the console. Use _IENavigate() on $wb2 to make IT go to $IEURL...

_IENavigate($wb2, $IEURL)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users