Can I make a label display the current webpage?

How can I call the URL that my HTMLViewer is currently on. For example if my HTMLViewer1 is on, I want a label to display “

Is it also possible to display the tab name?

You can get the current URL in the CancelLoad event. The tab title is available in the TitleChanges event.

A little more information, please?

I kinda a noob, sorry.

You use a HTMLViewer ,to display the web site…

There, Add an Event CancelLoad to be able to get the URL of the object actually on screen… That object title (when defined) is available in the TitleChanges Event (you also have to add to the HTMLViewer).

Is it clear now ?

Still not. Do I have to add code?


1 Like

Since you do not say whatyou’ve done…

Label1.Caption = URL

Of course, ,if you only need a part of the URL, you have to extract it from the URL string.

Better now ?


Or you could use javascript, see

Examples>Topics>User Interface>Desktop>HTMLViewer-ExecuteJavaScript

Then in btnGetTitleSync>Pressed change document.title to window.location.href

(All this is assuming you are using Xojo 2022r2)

Much better, could’ve said that the first time?

Takes time, busy doing something else; not paid to do that…

Need a break and send a second and much better message.

1 Like

How do I get the tab name?

Tab Name? It’s a single HTMLViewer there shouldn’t be tabs in it?

Do you mean the document title? The text that is shown in the “browser tab” when you visit a page with chrome for example?

If yes, then see my post above Can I make a label display the current webpage? - #8 by JulianS

Same as my previous answer: add an Event…

The Event name is: TitleChanged.

Yes, I understand all that but what is the code I add?

There are meant to be tabs, I’m making a browser.

Where do you want the NewTitle string appeared ?

How do you add a new Tab ?

Tab title

Var w As New <window>

Var s as String = w.Title