[Solved] THtmlViewer - HyperLinks are not working
lazarus / 31-LCL
----------------------------------------------------------------------
OLLI_S · 2019-02-28 15:18
Hello,
I am using Lazarus 1.8.4 in Windows 10 Professional x64.
I know that Lazarus 2.0 is out now, just had no time to install...
On my form I have a THtmlViewer and in the HTML-File that I am
displaying there is also a link:
Code: Text [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i https://website.com
The link is correctly displayed as link (blue font and underlined) and
when I move the mouse over the link, the mouse pointer changes to the
crHand cursor.
But when I click the link then nothing happens.
What is wrong?
Here the default browser should be openen and the link should be
opened in a new browser tab.
Thank you for you help!
Best regards
OLLI
----------------------------------------------------------------------
Handoko · 2019-02-28 17:54
I checked the info here:
https://github.com/BerndGabriel/HtmlViewer
It does not said it has the ability to get data directly from the web.
I could be wrong but I think it is only a html viewer, not a web
browser.
If you want to manually load the web data (and then supply the data to
the THtmlViewer), you can use TFPHTTPClient:
http://wiki.lazarus.freepascal.org/fphttpclient
If you want to detect the default web browser and open an URL using
it, you can try OpenURL:
http://wiki.lazarus.freepascal.org/Webbrowser#OpenURL
If you want a web browser, maybe these are what you're looking for:
http://wiki.lazarus.freepascal.org/fpbrowser
http://wiki.freepascal.org/fpCEF3
----------------------------------------------------------------------
OLLI_S · 2019-02-28 19:32
Hello,
I am using the THtmlViewer to display the Change-Log of my application
and the Help for my application.
So this is static text, nothing dynamic.
I one passage I have a link to a forum where users can give feedback.
So it would be cool if users are able to click the link, then the URL
is opened in the default browser.
The strange thing is that the link is displayed blue and underlined
and is also clickable.
But if I click it then nothing happens.
Best regards
OLLI
----------------------------------------------------------------------
lucamar · 2019-03-01 09:12
Add a handler for the OnHotSpotClick event and launch the browser
there, for example with OpenURL()
----------------------------------------------------------------------
OLLI_S · 2019-03-01 10:34
Quote from: lucamar on March 01, 2019, 10:12:44 amAdd a handler for
the OnHotSpotClick event and launch the browser there, for example
with OpenURL()
Thank you, it worked!
Did not know that there is a special OnHotSpotClick event for that.
Issue is solved!
----------------------------------------------------------------------
lucamar · 2019-03-01 10:49
Quote from: OLLI_S on March 01, 2019, 11:34:59 amDid not know that
there is a special OnHotSpotClick event for that.
Neither did I, though it was a strong posibility so I just downloaded
the latest THtmlViewer, dived into the documentation and checked with
the source. Easy.
----------------------------------------------------------------------
OLLI_S · 2019-03-01 10:52
Shaming for me...