Page 1 of 1

Navigation Callback not working - Default Browser

Posted: Tue Aug 18, 2015 10:00 pm
by JackWebb
Okay so..

I want to suppress navigation using IE from within a WebGadget, and use the default browser in it's place (the way it should be). The sample code below works fine and demonstrates what I am trying to accomplish. The problem is, it doesn't work in my working program. I suspect this may have something to do with the GadgetList but I've tried everything. Does anyone have an idea what may be going on?

I'm open to different method(s) of opening the default browser from within a WebGadget

Thank you in advance,
Jack

Code: Select all

;- Click on the news or download link
EnableExplicit

Declare NavigationCallback(Gadget, Url$)

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

Procedure NavigationCallback(Gadget, Url$)
  If Url$ = "http://www.purebasic.com/"
    Debug Url$
    ProcedureReturn #True
  Else
    Debug Url$
    RunProgram(Url$)
    ProcedureReturn #False
  EndIf
EndProcedure