Why IE opened when click a hyperlink in juce WebBrowser?


#1

windows,juce Demo .the WebBrowserDemo
There are something I don’t understand

sometimes,when click a hyperlink ,the “DemoBrowserComponent” will
call pageAboutToLoad(XXX),make Textbox changes,and goToURL(XXX).
thats OK.

BUT, sometimes when click on a hyperlink,the page will be displayed in a new IE window,
not the juceWebBrowser.Why IE opened ?why no one call pageAboutToLoad() ?


#2

Well, whether the embedded browser chooses to invoke the callback is really up to its discretion… I certainly have no idea how IE makes its mind up what to do when a link is clicked, I’m afraid!


#3

I think it’s because some links have their HTML set to be opened in a new window, like this one:

<a href="http://www.quackit.com/html/html_help.cfm" target="_blank">HTML Help</a> 

check out
http://www.quackit.com/html/codes/html_open_link_in_new_window.cfm


#4

THX! I think that’s the answer…“Open in a new window”!
So…Can I do something to avoid this?


#5

Sure you can.

You need to work on the underlying IWEbBrowser2 component that Juce wraps.

Just follow Microsoft’s explanation on how to do it:

http://msdn.microsoft.com/en-us/library/aa770041.aspx

“… You can intercept an event, DWebBrowserEvents2::NewWindow2, in your IDispatch implementation to control this. Your control needs to connect to the DWebBrowserEvents2 connection point to intercept this event.”

Good Luck!


#6

THX agian!! That’s cool! And…forgive me but how about on os?
Or…iOS?


#7

You should be able to do the same thing with the WebView in Osx.
I know that Jules added a web browser for iOS too lately, but unfortunately I’m not familiar with any of them.