[Gambas-user] WebPage and external files

Bruce Steers bsteers4 at gmail.com
Sun Nov 13 17:46:11 CET 2022


On Sun, 13 Nov 2022 at 13:16, Hans Lehmann <hans at gambas-buch.de> wrote:

> Hello.
>
> For the Gambas book on gambas-buch.de I would like to provide some
> simple web projects based on the class `WebPage`.
> For this I want to use the internal HTTP server - either in the IDE or
> in the console (**) with
>
> (1)
> Console:    hans at pc-mint20:~/CGI/wp_example1$ GB_HTTPD_PORT=8080 gbx3 -H
> (2)
> URL:        http://localhost:8080/
>
> Reason: Not everyone wants to install and configure an HTTP server like
> Lighttpd or Apache2 for first tests.
>
> For CSS I use Inline-CSS and for JavaSript Inline-JS, but this makes the
> source code difficult to read.
>
> However, I am unable to integrate multimedia objects such as images,
> favicons, audio files or video files.
>
> Question:
> When using the internal HTTP server in the IDE or via the console as in
> (**), is it possible to include the content of external files (CSS,
> JavaScript, multimedia objects)? If `Yes`, then I would like to know how
> this can be realised.
>
> With kind regards
>

Or maybe you are talking about this?...
WebForm.AddJavascriptFile(sFile As String)  ' to add your .js url
(I used this once and i think it mattered where i put it, it had to be
early, like in the header or the _new or _init i cannot remember, i'm sure
you will figure it out. you can use chromium or firefox devtools to see if
it's loaded properly)


as for css i think you can use WebControl._AddStyleSheet(sStyle As String)
but it not a URL it's the style text so you must load the file first using
File.load()

(there may be a way to load a css url directly but i do not know)

BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221113/eb324259/attachment-0001.htm>


More information about the User mailing list