How do I get the current URL of the page loaded in the browser widget

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 492
Joined: Thu Sep 04, 2008 6:23 am

How do I get the current URL of the page loaded in the browser widget

Post by jameshale » Sat Nov 08, 2025 8:22 am

Hi all,

I am stumped at determining the URL of the current page being displayed in the browser widget.

I have a stack with the widget and I set its URL

The page displays and I can interact with it.
Great.

I then click on a link within the page (actually on a pop upwundow) and go to another page.

How do I get the URL of this page?

Looking at the dictionary it seems I could respond to "browserDocumentLoadComplete pUrl"

But I don't know how to use it.
I am assuming it can be located in a script in the card.
So I tried...

Code: Select all

on browserDocumentLoadComplete pUrl
   put purl
end browserDocumentLoadComplete
But nothing.

Any ideas?

Klaus
Posts: 14267
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How do I get the current URL of the page loaded in the browser widget

Post by Klaus » Sat Nov 08, 2025 10:24 am

Hi James,

this works for me:

Code: Select all

on browserDocumentLoadBegin tUrl
   put tUrl
end browserDocumentLoadBegin
However "browserDocumentLoadComplete" also worked for me, but only tested in the IDE.

Best

Klaus

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 492
Joined: Thu Sep 04, 2008 6:23 am

Re: How do I get the current URL of the page loaded in the browser widget

Post by jameshale » Sat Nov 08, 2025 1:02 pm

Hi Klaus,
No still nothing here.
Was your script in the card?

James

Klaus
Posts: 14267
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How do I get the current URL of the page loaded in the browser widget

Post by Klaus » Sat Nov 08, 2025 1:07 pm

Yes, script was in the card.

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 492
Joined: Thu Sep 04, 2008 6:23 am

Re: How do I get the current URL of the page loaded in the browser widget

Post by jameshale » Sun Nov 09, 2025 6:12 am

Seems like it is the site I am going to. I need to invesitage more.

bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 171
Joined: Tue Feb 23, 2010 10:53 pm

Re: How do I get the current URL of the page loaded in the browser widget

Post by bobcole » Tue Nov 11, 2025 9:22 pm

This intrigued me so I did some research.
It looks like there is a direct way of getting the URL of the browser.

Code: Select all

on getTheURL
   get the URL of widget "MyBrowser"
   put it & return after field "The URL"
end getTheURL   
I hope this works for you.
Bob Cole

Post Reply