Pca
1
Hi,
I want to display HTML content into a WebBrowserComponent (actually, a “did you know” window shown at application startup).
The HTML content can expose hyperlink aimed to be open in external web browser. So I use HTML tag with target="_blank" attribute.
It’s working under Windows, but not under MacOSX. Clicking on the link do nothing where Windows open default web browser…
What can I do? any idea?
Many thanks,
/Phil
jules
2
You’re totally at the whim of the OS’s browser there, I’m afraid. It might be a security thing that’s stopping it opening a new window.
Although, you could try intercepting the click in the WebBrowserComponent, and launching the URL in your own code.
Pca
3
Ok, I was just thinking on something like that…
I’ll try right now what you suggest, thanks.
Pca
4
Ok its working
[code] class MyWebBrowser : public WebBrowserComponent
{
public:
MyWebBrowser() : WebBrowserComponent(false) {}
bool pageAboutToLoad(const String& newUrl)
{
if (!newUrl.startsWith("file://"))
{
PlatformUtilities::openDocument(newUrl,String::empty);
return false;
}
return true;
}
};[/code]
1 Like