Showing url bar in WebBrowserComponent


#1

Hi guys !

quick question : can I show by force the url bar in WebBrowserComponent? I do realize I don't have this kind of method in class.

to be more specific , I need it on windows, meaning the default browser will (probably) be IE. is there some JUCE-hack or WinAPI (or MFC/ATL, COM etc.) way to do so?


#2

A quick google search on this brings up several posts and docs stating that the IWebBrowser2 control that JUCE uses does not support a native address bar. See for example the remarks section of

https://msdn.microsoft.com/en-us/library/aa752110(v=vs.85).aspx

You'll need to implement one manually, for example, by overriding the pageAboutToLoad method to reflect the current url in your address bar and calling goToUrl when the user hits enter in your address bar textbox. Hope this helps!

 

 

 


#3

Amazing! this help a lot!

any Idea why this line :

IWebBrowser2* nativeHwnd= static_cast<IWebBrowser2*>(m_WebBrowser.getWindowHandle()); //m_WebBrowser is a subclass of WebBrowserComponent

keep giving me null ? I don't want to change JUCE source code in order to get the native handle..


#4

It's currently not possible to get the native IWebBrowser2 handle. It's stored on line 122 in the juce_WebBrowserComponent.h. Can you tell me why you need direct access to this? Quite surprisingly, any methods to  IWebBrowser2 (such as set_AddressBar) are completely ignored. 


#5

well, I need the handle in order to use set_AddressBar : - )

what d oyou mean by "any methods to  IWebBrowser2 (such as set_AddressBar) are completely ignored. "?


#6

By ignore, I mean, that set_AddressBar won't do anything when you call it - in particular it won't show the address bar.  See the remarks section of the link that I posted above. This is why you need to implement the address bar yourself by overriding the pageAboutToLoad and calling the goToUrl methods (see my first reply above). I don't see how having the raw handle of the IWebBrowser2 would help you.