HTMLViewer Current URL

If a user continues browsing from the HTMLViewer landing page how do I get the current URL?

Hello, I don’t know how to send a project file.

you can create an extension with this code:

Public Function CurrentURL(extends viewer as MobileHTMLViewer) As string
  return viewer.ExecuteJavaScriptSync( "window.location.href" )
End Function

Thanks Yvonick,

I tried call it a few different ways but can get it to autocomplete so obviously referencing incorrectly

label1.Text = HTMLViewer1.currenturl

Is your project an iOS project?

For a DesktopHTMLViewer:

Public Function CurrentURL(extends viewer as DesktopHTMLViewer) As string
  return viewer.ExecuteJavaScriptSync( "window.location.href" )
End Function

Mobile

Did you add the extension in a module, with global access?

It’s just a Method in a Global Module, correct?

Yes. With the scope “Global”.

Capture d’écran 2023-02-11 à 08.52.53

Hmm not sure what I changed but it’s working, thanks