Page 1 of 1
[Done] WebViewGadget + SpiderBasic-App?
Posted: Tue Dec 26, 2023 2:30 pm
by Kiffi
Hello,
has anyone of you managed to display a SpiderBasic app in a WebViewGadget?
This one does not work (WebViewGadget remains empty):
Code: Select all
OpenWindow(0, 0, 0, 1000, 800, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
WebViewGadget(0, 10, 10, 980, 780)
ReadFile(0, "C:\Temp\HelloWorld\index.html") ; a simple HelloWorld-App written in SpiderBasic
Html$ = ReadString(0, #PB_File_IgnoreEOL)
CloseFile(0)
SetGadgetText(0, Html$)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Unfortunately there is also no error message or anything similar.
Thanks in advance & best regards ... Peter
Re: WebViewGadget + SpiderBasic-App?
Posted: Tue Dec 26, 2023 6:52 pm
by infratec
Did you create a subdirectory named spiderbasic with the following files inside?
<script type="text/javascript" src="spiderbasic/platform.js"></script>
<script type="text/javascript" src="spiderbasic/init.js"></script>
<script type="text/javascript" src="spiderbasic/dojo/dojo.js"></script>
<script type="text/javascript" src="spiderbasic/main.js"></script>
<link rel="stylesheet" href="spiderbasic/dojo/themes/flat/flat.css" />
<link rel="stylesheet" href="spiderbasic/dojo/dgrid/css/dgrid.css" />
<script type="text/javascript" src="spiderbasic/xdate.min.js"></script>
<link rel="stylesheet" title="Default" href="spiderbasic/themes/flat/window.css" type="text/css"/>
It is not a 'single file' application.
Re: WebViewGadget + SpiderBasic-App?
Posted: Tue Dec 26, 2023 7:22 pm
by Kiffi
infratec wrote: Tue Dec 26, 2023 6:52 pmDid you create a subdirectory named spiderbasic with the following files inside?
Yes, of course. I created the app with the "Create App..." - function of SpiderBasic.
Re: WebViewGadget + SpiderBasic-App?
Posted: Tue Dec 26, 2023 7:26 pm
by infratec
In my case this does not produce a full directory.
All this was really needed:
\Test01\spiderbasic\dojo\
\Test01\spiderbasic\dojo\cbtree\
\Test01\spiderbasic\dojo\cbtree\errors\
\Test01\spiderbasic\dojo\dgrid\
\Test01\spiderbasic\dojo\dgrid\css\
\Test01\spiderbasic\dojo\nls\
\Test01\spiderbasic\themes\
\Test01\spiderbasic\themes\flat\
\Test01\index.html
\Test01\spiderbasic.js
\Test01\spiderbasic\canvas-toBlob.min.js
\Test01\spiderbasic\dojo\cbtree\errors\CBTErrors.json
\Test01\spiderbasic\dojo\dgrid\css\dgrid.css
\Test01\spiderbasic\dojo\dojo.js
\Test01\spiderbasic\dojo\nls\colors.js
\Test01\spiderbasic\dojo\nls\dojo_de.js
\Test01\spiderbasic\filesaver.min.js
\Test01\spiderbasic\init.js
\Test01\spiderbasic\interact.min.js
\Test01\spiderbasic\jquery.blockUI.min.js
\Test01\spiderbasic\jquery.injectCSS.js
\Test01\spiderbasic\jquery.min.js
\Test01\spiderbasic\jquery-ui.custom.min.js
\Test01\spiderbasic\main.js
\Test01\spiderbasic\mousetrap.min.js
\Test01\spiderbasic\mousetrap-global-bind.min.js
\Test01\spiderbasic\paper-full.min.js
\Test01\spiderbasic\platform.js
\Test01\spiderbasic\put.min.js
\Test01\spiderbasic\themes\flat\close.png
\Test01\spiderbasic\themes\flat\window.css
\Test01\spiderbasic\xdate.min.js
\Test01\Test01.sb
Simple Test: double click on the index.html file. If it opens correct in the browser it should open also in the gadget.
Re: WebViewGadget + SpiderBasic-App?
Posted: Tue Dec 26, 2023 7:49 pm
by Kiffi
infratec wrote: Tue Dec 26, 2023 7:26 pmSimple Test: double click on the index.html file. If it opens correct in the browser it should open also in the gadget.
the app loads without problems in the browser. The WebViewGadget() still remains empty.
I have added a global error handler to Index.html as a test.
Code: Select all
<script type="text/javascript">
window.onerror = function(msg, url, line, col, error) {
alert("Error: " + msg);
};
</script>
When I start my program I get the following message:
Error: Uncaught ReferenceError: dojoConfig is not defined
and afterwards:
Error: Uncaught ReferenceError: spiderCheckBrowser is not defined
The WebView runtime is up to date:

Re: WebViewGadget + SpiderBasic-App?
Posted: Tue Dec 26, 2023 8:42 pm
by infratec
Hm ...
is inside:
\Test01\spiderbasic\init.js
Also
In my index.html it is included:
Code: Select all
<script type="text/javascript" src="spiderbasic/init.js"></script>
Re: WebViewGadget + SpiderBasic-App?
Posted: Tue Dec 26, 2023 10:35 pm
by Kiffi
Very strange!
This is the HTML file that I load into the WebViewGadget:
Code: Select all
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="user-scalable=no, width=device-width, height=device-height, initial-scale=1, minimum-scale=1, maximum-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="text/javascript">var spider = {}; spider.nbModules = 1; spider.nbLoadedModules = 0;</script>
<title>HelloWorld</title>
<script type="text/javascript">function onLoad() { spiderCheckBrowser(); }</script>
<script type="text/javascript" src="spiderbasic/platform.js"></script>
<script type="text/javascript" src="spiderbasic/init.js"></script>
<script type="text/javascript">dojoConfig.baseUrl = 'spiderbasic/'; </script>
<script type="text/javascript" src="spiderbasic/dojo/dojo.js"></script>
<script type="text/javascript" src="spiderbasic/main.js"></script>
<script type="text/javascript" src="spiderbasic/debug.js"></script>
<link rel="stylesheet" href="spiderbasic/dojo/themes/flat/flat.css" />
<link rel="stylesheet" href="spiderbasic/dojo/dgrid/css/dgrid.css" />
<script type="text/javascript" src="spiderbasic/xdate.min.js"></script>
<link rel="stylesheet" title="Default" href="spiderbasic/themes/flat/window.css" type="text/css"/>
<script type="text/javascript" src="spiderbasic.js?t=1703626203"></script>
</head>
<body oncontextmenu="return false;" class="flat" id="spiderbody" onload="onLoad()">
</body>
</html>
If I then right-click on the WebView gadget and select "Save as...", it will be saved here:
Code: Select all
<!DOCTYPE html>
<!-- saved from url=(0011)about:blank -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="user-scalable=no, width=device-width, height=device-height, initial-scale=1, minimum-scale=1, maximum-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="text/javascript">var spider = {}; spider.nbModules = 1; spider.nbLoadedModules = 0;</script>
<title>HelloWorld</title>
<script type="text/javascript">function onLoad() { spiderCheckBrowser(); }</script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript">dojoConfig.baseUrl = 'spiderbasic/'; </script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">
<script type="text/javascript" src=""></script>
<link rel="stylesheet" title="Default" href="" type="text/css">
<script type="text/javascript" src=""></script>
</head>
<body oncontextmenu="return false;" class="flat" id="spiderbody" onload="onLoad()">
</body></html>
All src attributes are empty. Why?
Re: WebViewGadget + SpiderBasic-App?
Posted: Tue Dec 26, 2023 10:41 pm
by Fred
I think you will need to specify a path to have it working, I will add this for the next beta.
Re: WebViewGadget + SpiderBasic-App?
Posted: Wed Dec 27, 2023 11:49 am
by DarkDragon
Do you have a developer console inside the new webview or similar? This way you could check for CSP errors or similar.
Re: WebViewGadget + SpiderBasic-App?
Posted: Wed Dec 27, 2023 12:05 pm
by Kiffi
No, I do not have access to the DEV console in the WebViewGadget.
Re: WebViewGadget + SpiderBasic-App?
Posted: Sun Jan 28, 2024 1:08 pm
by Kiffi
Works perfectly now

Thanks @Fred!
Code: Select all
OpenWindow (0, 0, 0, 1000, 800,"", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
WebViewGadget(0, 10, 10, 980, 780)
SetGadgetText(0, "file://c:/temp/helloworld/index.html")
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: [Done] WebViewGadget + SpiderBasic-App?
Posted: Mon Jan 29, 2024 10:37 am
by dige
I've read it somewhere before, but unfortunately I've forgotten it

... what's the difference between the two gadgets again?
Code: Select all
OpenWindow (0, 0, 0, 1600, 800,"", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
WebViewGadget(0, 10, 10, 700, 780)
WebGadget (1, 710, 10, 700, 780, "", #PB_Web_Edge)
SetGadgetText(0, "https://www.whatsmybrowser.org")
SetGadgetText(1, "https://www.whatsmybrowser.org")
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow