WebControlWrapper example HTMLArea: my links are not correct

  1. 2 months ago

    Jean-Yves P

    Mar 22 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    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 127.0.0.1:8080/"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 ?

    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. :)

  2. Tim P

    Mar 22 Pre-Release Testers Rochester, NY

    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.

  3. Jean-Yves P

    Mar 22 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

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

  4. Tim P

    Mar 22 Pre-Release Testers Rochester, NY

    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>"
  5. Tim P

    Mar 22 Pre-Release Testers Rochester, NY

    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.

  6. Jean-Yves P

    Mar 22 Pre-Release Testers, Xojo Pro Europe (France, Besançon)
    Edited 2 months ago

    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 127.0.0.1:8080/"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.

  7. Tim P

    Mar 22 Pre-Release Testers Rochester, NY

    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?

  8. Jean-Yves P

    Mar 22 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    here is the web project
    the "xojo" text should get us to the xojo web site and it doesn't.
    https://www.cjoint.com/c/ICwvCk8mnXz

  9. Jean-Yves P

    Mar 22 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    @Tim P What is your end goal here? Are you implementing a desktop app that handles "msgbox:" urls?

    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

  10. Tim P

    Mar 22 Pre-Release Testers Answer Rochester, NY
    Edited 2 months ago

    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. :)

  11. Jean-Yves P

    Mar 22 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    @Tim P Other than that, you've got it set up correctly for passing events back to Xojo. :)

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

  12. Jean-Yves P

    Mar 22 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

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

  13. Jean-Yves P

    Mar 22 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    anyway thanks for the help Tim !

  14. Jean-Yves P

    Mar 22 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

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

  15. Tim P

    Mar 22 Pre-Release Testers Rochester, NY

    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 :/

or Sign Up to reply!