MBS Xojo Conference
6/7th September 2018, Munich

« REAL Studio Summit 20… | Home | Tipp of the day: Shel… »

Tipp of the day: Jump to anchor in htmlviewer


Let's say you have loaded a website to your htmlviewer, e.g. this one: http://www.monkeybreadsoftware.net/addressbook-abpersonmbs.shtml. Now you want to jump with a button to anchor #16 (on the bottom of the sample page). How to do this?

LoadURL with "#16" will not work as well as passing javascript to it. The only solution I got to work is to use our javascript execute methods:
  Sub Open() 
    htmlviewer1.LoadURL "http://www.monkeybreadsoftware.net/addressbook-abpersonmbs.shtml"
  End Sub
  Sub Action() 
    if TargetWin32
      call HTMLViewer1.IERunJavaScriptMBS "window.location = ""#16"""
    elseif TargetMacOS then
      call HTMLViewer1.EvaluateJavaScriptMBS "window.location = ""#16"""
    else
      // not supported
    end if
  End Sub
02 08 10 - 00:18
No comments

  
Remember personal info?

Emoticons / Textile


Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.