wxIEHTML

L

LutherRevisited

I know I asked this question before about wxhtml windows(thanks for the
answer), now I'm wanting links to open up in my default browser when I click on
them from a wxIE window. I realize that all I have to do is right-click on the
link and just open it in a separate window, but in the interests of
completeness, if anybody can tell me how this can be done I'd be grateful.
 
C

Cliff Wells

I know I asked this question before about wxhtml windows(thanks for the
answer), now I'm wanting links to open up in my default browser when I click on
them from a wxIE window. I realize that all I have to do is right-click on the
link and just open it in a separate window, but in the interests of
completeness, if anybody can tell me how this can be done I'd be grateful.

I don't think there's any way to intercept clicking links using the
embedded IE browser. You can check the source file for the module to
get an overview of what you can do.

Cliff
 
W

Will McGugan

LutherRevisited said:
I know I asked this question before about wxhtml windows(thanks for the
answer), now I'm wanting links to open up in my default browser when I click on
them from a wxIE window. I realize that all I have to do is right-click on the
link and just open it in a separate window, but in the interests of
completeness, if anybody can tell me how this can be done I'd be grateful.

In C++ you override the OnStartURL function. I imagine there is an
equivelent Python function.

Alternatively, if you have control over the html you can set
target=_blank for all your links.

Will McGugan
 
D

Daniel Bickett

In C++ you override the OnStartURL function. I imagine there is an
equivelent Python function.

At which point it would be best to use urllib to open the url, being
that you want the link to open up in the default browser.

Daniel Bickett
 
T

tutu

Cliff Wells said:
I don't think there's any way to intercept clicking links using the
embedded IE browser. You can check the source file for the module to
get an overview of what you can do.

Cliff

maybe something like the following?
<pre>
import webbrowser
EVT_MSHTML_BEFORENAVIGATE2(self, -1, self.OnBeforeNavigate2)

def OnBeforeNavigate2(self, event): #IE event
url = event.GetText1()
webbrowser.open(url) #open in default browser
event.Veto() #don't open here
</pre>
 
C

Cliff Wells

maybe something like the following?
<pre>
import webbrowser
EVT_MSHTML_BEFORENAVIGATE2(self, -1, self.OnBeforeNavigate2)

def OnBeforeNavigate2(self, event): #IE event
url = event.GetText1()
webbrowser.open(url) #open in default browser
event.Veto() #don't open here
</pre>

Ah, cool. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,125
Latest member
VinayKumar Nevatia_
Top