HtmlViewerCustomGui - get link?
On 24/03/2017 at 11:37, xxxxxxxx wrote:
Hello plugincafe community!
I have a litle question regarding the HtmlViewerCustomGui. Is it possible to not only set but also retrieve the link/webpage the user is currently on?
In the python docs only SetUrl is given.
On 27/03/2017 at 01:31, xxxxxxxx wrote:
To keep track of the current webpage shown in a HtmlViewerCustomGui, a callback has to be registered.
Here's some code:
# In the dialog class define this function def HtmlViewerCallback(self, user_data, url, encoding) : print "Navigating to " + url // In the dialog CreatLayout() sets the URL callback htmlViewer.SetURLCallback(self.HtmlViewerCallback)
Note the user_data parameter passed to the callback is always None.
And the optional user_data that can be passed to HtmlViewerCustomGui.SetURLCallback() is not used because of the Python API implementation.
Also I'm afraid there's no way to get the link the mouse pointer is over.
On 28/03/2017 at 08:23, xxxxxxxx wrote:
Thanks Yannick for the quick reply!
It does work really well!
Altough (and I am not sure if this has anything to do with the HtmlViewerGui) when I am on a website with a facebook like field I only get the link to this facebook field (or like button for that matter) and not the actual link I am currently on.
Is this because of the script (from facebook) beeing loaded last or is this a bug?
On 29/03/2017 at 04:40, xxxxxxxx wrote:
The URL callback only gets called when there is a full page load. HtmlViewerCustomGui does not provide dynamic feedback from within a page.
HtmlViewerCustomGui is quite limited and don't expect much from it. This GUI main purpose is to display the simple HTML files for Cinema's Help.