How to get the webbrowser address ?

Windows specific forum
User avatar
daviddeargentina
New User
New User
Posts: 6
Joined: Fri Jun 30, 2023 7:37 pm

How to get the webbrowser address ?

Post by daviddeargentina »

Hi all,

I'm new user and i'm testing the MiniBrowser sample, change a couple of actions and all works fine -yet-

I'm trying to get a variable with the clicked link on any webpage. program goes to the new location, but i can`t get the new url address.

Any ideas to solve this ?

Greetings from Buenos Aires, Argentina
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: How to get the webbrowser address ?

Post by jassing »

daviddeargentina wrote: Fri Jun 30, 2023 7:57 pm I'm trying to get a variable with the clicked link on any webpage. program goes to the new location, but i can`t get the new url address.
From the help file for webgadget wrote: GetGadgetText(): Get the current URL.
User avatar
daviddeargentina
New User
New User
Posts: 6
Joined: Fri Jun 30, 2023 7:37 pm

Re: How to get the webbrowser address ?

Post by daviddeargentina »

Thanks a bunch!
User avatar
Kiffi
Addict
Addict
Posts: 1485
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: How to get the webbrowser address ?

Post by Kiffi »

you can also use the NavigationCallback:

Code: Select all

Procedure NavigationCallback(Gadget, Url$)
  Debug Url$
  ProcedureReturn #True
EndProcedure   

OpenWindow(0, 0, 0, 1000, 800, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
WebGadget(0, 0, 0, 1000, 800, "https://www.purebasic.com") 

SetGadgetAttribute(0, #PB_Web_NavigationCallback, @NavigationCallback())

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Hygge
User avatar
daviddeargentina
New User
New User
Posts: 6
Joined: Fri Jun 30, 2023 7:37 pm

Re: How to get the webbrowser address ?

Post by daviddeargentina »

very interesting alternative. thank you so much.

I'm still investigating:
if I change the url from purebasic.com to (for example)

https://maps.google.com/maps?z=10&t=m&q ... 5209230567

after a couple of seconds, google does not validate credentials and asks to change browser.

Is there a way to fix this?

Thanks again

David
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: How to get the webbrowser address ?

Post by jassing »

I don't know what the webgadget is based on, but like that it's just a simple browser, no ajax/javascript, etc.

Maybe use one of the chromium extensions? Probably have better luck with those.
Post Reply