Page 1 of 1

Link or Close

Posted: Mon Jun 19, 2023 1:14 pm
by bmld76
hello,

I don't found how to quit the spider page. I want to close it or put a link to open an another page.

Cordially

Re: Link or Close

Posted: Mon Jun 19, 2023 2:00 pm
by Peter

Code: Select all

Procedure ButtonEvent()
  If MessageRequester("Really?", #PB_MessageRequester_YesNo) = #PB_MessageRequester_Yes
    ! window.close();
  EndIf
EndProcedure

OpenWindow(0, 0, 0, 300, 200, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 280, 180, "Close window (current tab)")
BindGadgetEvent(0, @ButtonEvent())

Re: Link or Close

Posted: Mon Jun 19, 2023 6:52 pm
by bmld76
Thank, but this commande don't work on IPAD only on computer.

I correct : it works when you call the page from an another.

Cordially

Re: Link or Close

Posted: Mon Jun 19, 2023 8:14 pm
by Peter
I don't own an iPad, so I'm out.

Re: Link or Close

Posted: Thu Jun 22, 2023 12:50 pm
by bmld76
Hello,

I found a simple solution. After creating the app, I add in the index.html a button to link an another site.

Re: Link or Close

Posted: Thu Jun 22, 2023 5:48 pm
by Paul
Maybe you are looking for this procedure? (I think it also came from Peter)

Code: Select all

Procedure RunProgram(Filename.s, Parameter.s="")
  !  if (v_parameter != "") {
  !    var win = window.open(v_filename, v_parameter);
  !    win.focus();
  !  } else {
  !    window.open(v_filename);
  !  }
EndProcedure


Procedure CloseWindowEvent()
  WindowID=EventWindow()
  Select WindowID
    Case 0      
      RunProgram("https://google.com","_parent")
      CloseWindow(0)
  EndSelect
EndProcedure

Procedure GadgetEvent()
  GadgetID=EventGadget()
  Select GadgetID
    Case 1
      RunProgram("https://spiderbasic.com")
  EndSelect
EndProcedure

OpenWindow(0, 0, 0, 300, 200, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(1, 10, 10, 280, 180, "Visit SpiderBasic")
BindGadgetEvent(1, @GadgetEvent())
BindEvent(#PB_Event_CloseWindow,@CloseWindowEvent())

Re: Link or Close

Posted: Thu Jun 22, 2023 9:30 pm
by bmld76
Very interesting, I will test it . Thank

Re: Link or Close

Posted: Fri Jun 23, 2023 9:51 am
by bmld76
So, the procedure works correctly. But, is it possible to find doc ob this.

what is a line beginning with !

Cordially

Re: Link or Close

Posted: Fri Jun 23, 2023 3:45 pm
by Paul
Lines beginning with ! are inline javascript, they are not native SpiderBasic commands.

Re: Link or Close

Posted: Sat Jun 24, 2023 3:21 pm
by bmld76
ok, thank