(SOLVED) fp-web trick and help lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- xinyiman · 2018-11-16 07:39 Good morning, I created a web project using the fazar-lazarus components. You can find the project here: www.lazaruspascal.it/esempi/test_web_app.zip My intent is to keep HTML files out of the executable. In the past I had already tried to use the AdmLte template to a lazarus web project but without success, because once the html page was called, all the css, js files contained in the HTML file were not returned. Now with a little trick I can get all the files back from my embedded web server, but the result to the browser is not correct. Who tells me which detail escapes me? The comments in the executable are in Italian, but the source is really simple, there are a few lines of code. Then in unit1 in the DataModuleRequest (here you have to change the value of the url: = 'your_path/test_web_app' + url; with the path of your operating system) you will find the heart of my reasoning. Thanks to anyone who wants to give me a hand ---------------------------------------------------------------------- xinyiman · 2018-11-16 12:41 Solved with this code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TTFPWebModule1.DataModuleRequest(Sender: TObject; ARequest: TRequest;  AResponse: TResponse; Var Handled: Boolean);var  url: string;  fine_nome_file: integer;  f: TFileStream;  estensione: string;  ret: boolean;begin      ret:=false;      url := stringReplace(ARequest.URL, '/', System.DirectorySeparator, [RfReplaceAll]);      if trim(url)<>'' then     begin       url := '/Users/francesco/Documents/sw/cgi2test' + url;       fine_nome_file:=Pos('?',url);       if fine_nome_file>0 then       begin            url:=Copy(url,1,fine_nome_file-1);       end;     end;      if FileExists(url) then     begin         writeln('trovato:' + url);         f := TFileStream.Create(url,fmOpenRead);         try           AResponse.Code:=200;           AResponse.FreeContentStream := False;            estensione:=ExtractFileExt(url);            if uppercase(estensione) = '.CSS' then              AResponse.ContentType := 'text/css;charset=utf-8'           else               AResponse.ContentType := 'text/html;charset=utf-8'; // 'application/octet-stream'; //<--questo commentato serve per mandare file al browser           AResponse.ContentStream := f;           AResponse.SendContent;           ret:=true;         finally           f.Free;         end;     end else begin         writeln('non trovato:' + url);     end;     ret:=true;     Handled:=ret;end;