WebControlWrapper example HTMLArea: my links are not correct

Hi folks,

just trying my first WebControlWrapper. read the sdk, trying the example.
my links are not correct
when I “mouseover” the links, I get"msgbox VERY/"
where I should have msgbox VERY

I have the good value if I run the htmlarea example of the websdk folder
but in the project I made following the example in the pdf

what did I possibly wrong ?

Most browsers show the full URL of a link when moused over, even if it’s relative.
Due to security concerns, you can no longer replace the link destination hover effect with a custom message.

if I launch the htmlarea example of the websdk folder, the mouseover displayed by the browser are ok, without the !

Neither of the links in the example are relative. The link with the src internal:Hello There! is actually a destination with a different protocol (“internal:”). If you’d like to see how a relative link would look, add this line to ChangeButton.Action:

src = src + "<p><a href=""my_doc.pdf"">Relative Link</a></p>"

If you’re trying to do something other than customize the hover message I’m happy to help. What is your goal?

Browsers have all updated to no longer allow customizing that message as malicious parties used that feature to mask dangerous links. Heck, Chrome/WebKit don’t even allow Javascript to update that property at all. That’s what all the HTMLViewer hubbub was about.

I have this html that goes to the HTMLArea :

<a onclick=\"Xojo.triggerServerEvent(\\'B580ZBC7\\',\\'Link\\',[this.href]);return false;\" href=\"msgbox:Very Cool!\">COOL!</a>

I copied this from stopping with the debugger at the end of processHtml method.
but I see"msgbox VERY/" with the browser !
I should see msgbox:Very Cool! and don’t understand where is my mistake … (there is one !)

again: the given example project “htmlarea” in the websdk folder works fine.
I made a project following the websdk pdf instructions, and this project does not work like it should.

The TriggerServerEvent isn’t going to work, you can’t hard code the control ID.

If I set the source src to “msgbox: very cool” I see exactly what should be expected, “msgbox: very cool” in my browser, I’m using Firefox. Again, the contents of this tag is controlled by the browser so different browsers could render it differently.

What is your end goal here? Are you implementing a desktop app that handles “msgbox:” urls?

here is the web project
the “xojo” text should get us to the xojo web site and it doesn’t.

no I want to make a simple webcontrolwrapper that can intercept clics on web links.
I don’t want to use it, I’m training to understand how to get back javascript events to xojo web

The ProcessHTML method is causing trouble. The ReplaceAll.ReplaceAll is replacing quotes that shouldn’t be escaped. Comment out line 20 of ProcessHTML and this project will work like you expect. Quotes that are within a string are safe for being transmitted to the browser. There are instances in which you will have to escape them but not with what you’re doing here.

Other than that, you’ve got the idea for passing events back to Xojo. :slight_smile:

I know this one :wink: first the correct links, then only try to catch the events !

the processhtml method has been copy-pasted from the working example of the websdk folder. it should work ?
(and it works in the example…)

anyway thanks for the help Tim !

look at the /Extras/WebSDK/Examples/HTMLArea.xojo_binary_project
the processhtml method is the same, and the links are working in this one.

If I paste your HTML into the inspector property of the example project, I get the same undesirable behavior you were seeing in your project. It looks like it’s related to how that property gets set. I can’t tell you much more than that :confused: