I want to load my web project into my delphi app, using the component TWebBrowser. My project bases on angular tree grid and works on all browsers including IE. When I loaded the web project into Delphi XE8 project and ran the app, suddenly some error appeared, so I searched on StackOverflow, found this. Also some 'tricks' from other pages didnt help. I loaded the basic example of the angularJS plugin, found here (just to be sure, it isn't my codes fault).
The code I used in Delphi is:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.OleCtrls, SHDocVw;
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormShow(Sender: TObject);
begin
WebBrowser1.Navigate('file://C:\Users\Peter\Documents\Embarcadero\Studio\Projects\Win32\Debug\index.html');
end;
end.
EDIT: This Delphi code only navigates to the index.html on my PC. The index.html is the same as here . And yes, all other files are correctly set. The index.html works in other browsers.
QUESTION: How to fix this for Delphi
UPDATE (SOLUTION): As the question was marked as a duplicate because the solution was found here, it didn't work in my case ...as I wanted. Yes, it worked for the demo example of plugin (because it included scripts from web, mine was LOCALLY).
After hours of working on the case, I've found a solution on a MS forum.
- I suggest you to validate the Javascript code -in my case i didn't include atributes like type="text/javascript" to the script tag
- As next, the solution I found on MS forum was the way they included the script:
- an example of a script include is:
<script type="text/javascript" src="file://127.0.0.1/c$/<MY_PATH_TO_FILE>.js"></script>
- an example of a script include is:
- And finally, thanks to user whosrdaddy for mentioning a solved case
- So I had to add
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
- So I had to add
I hope that this will work for someone..