It is currently Sat Jul 20, 2019 8:57 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: WebGadget links open in default browser?
PostPosted: Fri Nov 17, 2017 12:08 pm 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1893
If I have a WebGadget in my app, can I make any clicked links open OUTSIDE of my app and in the PC's normal default browser instead? Sort of like the "target=_blank" meta-tag but for links that don't have that tag? I basically want to use the WebGadget to show an index page of links (that I didn't create, and hosted by someone else) but they open outside of my app. Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: WebGadget links open in default browser?
PostPosted: Fri Nov 17, 2017 1:06 pm 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1034
Location: Germany::Berlin()
You can add a WebGadget callback and check the links.
Look in the help for WebGadget and #PB_Web_NavigationCallback.

_________________
ImageImageImageImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: WebGadget links open in default browser?
PostPosted: Fri Nov 17, 2017 1:15 pm 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1893
Wow, I can't believe it was that simple! :shock: Thanks!

For my future reference:

Code:
Procedure NavigationCallback(Gadget, Url$)
  If Url$= "http://www.purebasic.com/news.php"
    RunProgram(Url$) ; Open in default browser.
    ProcedureReturn #False
  Else
    ProcedureReturn #True
  EndIf
EndProcedure

If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  WebGadget(0, 10, 10, 580, 280, "http://www.purebasic.com")
  SetGadgetAttribute(0, #PB_Web_NavigationCallback, @NavigationCallback())
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye