Hi All,
Take a look at this screenshot. It shows the same webpage
loaded from mchttpd and opened directly in the browser:
Test this by yourself. Download the stack from:
http://fourthworld.net/lc/mchttpd-4W.zip
Open the stack, click start server and load this webpage
in the browser: http://127.0.0.1:8080/index.html
Why loading this webpage using mchttpd does not show
all images?
Now load the same index.html directly from hard disk,
(not using mchttpd) and the internet browser show all
images correctly.
Notice that when I load an image directly, through mchttpd
the browser shows the binary data of the image as text.
for example: http://127.0.0.1:8080/index.png
Just in case that it was a problem of mime types, I changed
every instance of "text/html" to "image/png" and it does
not shows the image anyway.
Which changes requires the script of mchttpd to load
in the browser all png or jpg as images instead of text?
Al
mchttpd LiveCode server do not load images
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: mchttpd LiveCode server do not load images
After reading many webpages, I found the answer:
replace "file" with "binfile" in this script:
This is the script change that works and load all images:
Of course, if mchttpd works fine in Linux with "binfile" instead of "file"
(still have not tested this change in Linux) then delete the if structure
and put only this line:
Al
replace "file" with "binfile" in this script:
Code: Select all
if the platform is "MacOS" then
put "binfile:" & oDir & "/html/" & pFile into xFile
else put "file:"& oDir & "/html/" & pFile into xFile
Code: Select all
if the platform is "MacOS" then put "binfile:" & oDir & "/html/" & pFile into xFile
else put "binfile:"& oDir & "/html/" & pFile into xFile
(still have not tested this change in Linux) then delete the if structure
and put only this line:
Code: Select all
put "binfile:"& oDir & "/html/" & pFile into xFile
Re: mchttpd LiveCode server do not load images
Interesting find Al.
Re: mchttpd LiveCode server do not load images
I suspect that modern browser behave different that
early internet browsers for security reasons and that
explain why images are not loaded automatically.
In our present day internet, if you want to open
any kind of image inside the browser, the server
or maybe the browser itself creates a a minimal
html wrapper, like this:
Look the list of vulnerabilities created
by files that are misidentified:
https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=mime
After i finish some pending work, maybe I could resume my previous
work in a Livecode based wikipedia reader. Maybe...
Al
early internet browsers for security reasons and that
explain why images are not loaded automatically.
In our present day internet, if you want to open
any kind of image inside the browser, the server
or maybe the browser itself creates a a minimal
html wrapper, like this:
Code: Select all
<html>
<head></head>
<body>
<img max-width=100% height="auto" src="http://127.0.0.1:8080/myimage.png"></img>
</body>
</html>
by files that are misidentified:
https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=mime
After i finish some pending work, maybe I could resume my previous
work in a Livecode based wikipedia reader. Maybe...
Al