Lazarus

Programming => Networking and Web Programming => Topic started by: xinyiman on September 06, 2019, 11:23:42 pm

Title: adminlte test
Post 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.
Title: Re: adminlte test
Post by: zamronypj on September 07, 2019, 12:34:24 am
I have not try your code. But you may want to take a look at chrome developer tools to inspect what is wrong.
Title: Re: adminlte test
Post by: xinyiman on September 07, 2019, 06:14:55 pm
Done, and this returns.
Code: Pascal  [Select][+][-]
  1. Content-Length: 52549
  2. Content-Type: addtype
  3. Status: 200 OK
  4.  
I just don't understand how to solve it. I do not think that "Content-Type: addtype". How solve?!
Title: Re: adminlte test
Post by: zamronypj on September 08, 2019, 03:39:03 pm
You should add proper Content-Type response header. If you returns HTML document then it should be text/html

Code: [Select]
ARespons.ContentType :='text/html';
Title: Re: adminlte test
Post by: xinyiman on September 08, 2019, 06:19:52 pm
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
Title: Re: adminlte test
Post by: zamronypj on September 08, 2019, 11:42:20 pm
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

Code: [Select]
uses
       ...
      fpmimetypes;
...
mimeTypes().loadfromFile(yourPathToMimeTypes);
TinyPortal © 2005-2018