Link to #PB_LocalStorage (?)

Just starting out? Need help? Post your questions and find answers here.
AZJIO
Posts: 76
Joined: Wed Dec 14, 2022 1:13 pm

Link to #PB_LocalStorage (?)

Post by AZJIO »

How to get a link to the find.htm file

Code: Select all

Procedure SaveCallback(Status, Filename$, id_file, Size)
	Select Status
		Case #PB_Status_Saved
			Debug 1

		Case #PB_Status_Error
			Debug 0
	EndSelect
EndProcedure

#Window = 0
#WebG = 0
ww = 1000
hh = 600
If OpenWindow(#Window, 0, 0, ww, hh, "", #PB_Window_Background)
	WebGadget(#WebG, 0, 35, ww, hh - 35, "")
EndIf
	
	
g_id_file = CreateFile(#PB_Any, "find.htm", @SaveCallback(), #PB_LocalStorage | #PB_UTF8)
If g_id_file
	For i = 1 To 5
		WriteStringN(g_id_file, Str(i), #PB_UTF8)
	Next
	CloseFile(g_id_file)
	SetGadgetText(#WebG, "find.htm")
; 	SetGadgetText(#WebG, "http://127.0.0.1:9080/find.htm") ; ?
EndIf
If I use "./data/find.htm" then that doesn't work either.
User avatar
Peter
Posts: 1197
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Link to #PB_LocalStorage (?)

Post by Peter »

If you create a file with the #PB_LocalStorage flag, it is not physically created, but stored in a memory area of the browser. You can view this in the developer console:

Image

(The library used for this in SpiderBasic is called localForage. For this reason, you will find it there (and not under LocalStorage))
Post Reply