Get exact url for the page shown in htmlviewer

I think this is a stupid question, but I need it and I’m breaking my head around it…

I have an htmlviewer. Into it I load a webpage (www.xojo.com for example), and when the page is loaded I need to have returned the exact url loaded (for example http://www.xojo.com/index.php).

How?

Many thanks!!!

http://documentation.xojo.com/index.php/HTMLViewer.CancelLoad

CancelLoad will let you know what the URL is before loading it, allowing you to handle and if desired cancel the load.
To get the URL of the page once it’s finished loading (like a redirect to index.php) it may be beneficial to employ the http://documentation.xojo.com/index.php/HTMLViewer.DocumentComplete event instead. :slight_smile:

Actually there is a bit of an oddity with document complete
See <https://xojo.com/issue/37923>
It seems the underlying HTML component really doesn’t tell you the correct URL until you eventually reload it

Well that’s crappy

Tell me about it
Screwy part is that its not Xojo doing something
The case notes I put in there even ask the underlying OS component & it too does this
So I’m not sure how you can know for sure

Mac? Win? Linux?
which browser exactly?
Maybe I can help with MBS plugins…

e.g. for Mac this would work:

MsgBox HTMLViewer1.mainFrameMBS.dataSource.response.URL

[quote=165334:@Norman Palardy]Actually there is a bit of an oddity with document complete
See <https://xojo.com/issue/37923>
It seems the underlying HTML component really doesn’t tell you the correct URL until you eventually reload it[/quote]
Norman unless you have uncovered additional test results :slight_smile: The oddity only came when I was trying to get the Redirected URL from the DocumentComplete or CancelLoad events on OS X. The Direct URL worked every time for me.

HTH :slight_smile: