Lazarus
Programming => Networking and Web Programming => Topic started by: xinyiman on September 06, 2019, 11:23:42 pm
-
Hi guys, sometimes we try again. I want to create a small lazarus web application with adminLTE graphics. I had already tried indy, but now I want to try the native lazarus tools. If you decompress the example that I attach, you will see that in the bin / i386-win32 / folder you find a "files_extra" folder, to which you must manually add the "AdminLTE_Files" folder after downloading AdminLTE from the address:
https://github.com/ColorlibHQ/AdminLTE/archive/v2.4.18.zip
Move the content from the folder where you find the index.html file in the "AdminLTE_Files" folder
Change the paths in the uConsts.pas file based on where you place your example
Compile and run the example, then open the browser at: http://localhost:9090/adminlte_files/index.html
You will see that with firefox it works correctly, with chrome no. Who can explain me why? Moreover, assuming you want to change the html of the index.html when it appears in the browser, in your opinion what event should I use ?! The latter thing is used to enhance the variables to be presented to the browser.
-
I have not try your code. But you may want to take a look at chrome developer tools to inspect what is wrong.
-
Done, and this returns.
Content-Length: 52549
Content-Type: addtype
Status: 200 OK
I just don't understand how to solve it. I do not think that "Content-Type: addtype". How solve?!
-
You should add proper Content-Type response header. If you returns HTML document then it should be text/html
ARespons.ContentType :='text/html';
-
Thanks, but these are files that are not linked to the application, returned thanks to Serving Static Files (Embedded Web Server). So I don't know how
-
I do not quite understand what you mean. But if you load static files, make sure you properly setup its MIME types based on its file extension.
AFAIK
uses
...
fpmimetypes;
...
mimeTypes().loadfromFile(yourPathToMimeTypes);