[Gambas-user] WebPage and external files

T Lee Davidson t.lee.davidson at gmail.com
Wed Nov 16 02:41:03 CET 2022

On 11/14/22 11:57, T Lee Davidson wrote:
> On 11/13/22 12:35, T Lee Davidson wrote:
>> On 11/13/22 11:48, Hans Lehmann wrote:
>>> unfortunately the implementation of this hint does not bring the hoped for access to the content of external files like 
>>> style.css or logo.png.
>> Hmmm, that should work.
>> Are you certain you are specifying the path correctly?
>> If you have a style sheet in the project's Public directory (and not in a subdirectory of that directory), the link tag in the 
>> HEAD of the web page should be similar to:
>> <link rel="stylesheet" type="text/css" href="<%/%>/style.css">
>> I just tried it with both a style sheet and an image (in a "img" subdirectory), and it does work.
> Attached is the test project I used based on the example given at:
> http://gambaswiki.org/wiki/doc/webpage

[I apologize to the members of this list for the lack of context as the other half of this conversation has been sent to me 

That particular project works fine with the IDE's embedded http server. However, it does not work as expected on either Apache 
or Lighttpd web servers.

It appears that the files, linked in the WebPage using <%=Application.Root%>, are provided to the server by the Gambas 
executable (eg. the path for style.css in the project's Public directory is <Document_Root>/webapp.gambas/style.css).

This does not work on the web servers, apparently, due to what the executable is providing to the server as hinted at by this 
browser console error message:
The stylesheet http://localhost:8888/~user/webapp.gambas/style.css was not loaded because its MIME type, “text/html”, is not 

Indeed, what the server is receiving is the actual HTML of the page itself as can be seen by the attached pic.

I think it is a bug. But, I could be wrong.


P.S. Hans, the questions you ask me privately are more appropriately posed to this list. In that way, the community can benefit 
from the discussion and solution. There is no reason for you to contact me off-list. I am not your personal consultant.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot_gambaswebpage.png
Type: image/png
Size: 67984 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221115/ff9325a2/attachment-0001.png>

More information about the User mailing list