Hi,
I can't check your js code but I would try to set a URL in the second ExecuteJavaScript parameter, for example about:blank.
Remember to call ExecuteJavaScript when the document is fully loaded and in case you want to save a few key strokes, you can also call Chromium1.ExecuteJavaScript directly.
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
save file using javascript
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: save file using javascript
The window.open command will open a new tab or window in the browser. If you don't add the code to create and manage the popup windows then CEF3 will create a new window for you and TChromium has some problems with that.
Try setting Result := True in the TChromium.OnBeforePopup event to cancel the popup creation.
Handling the popup windows is very complicated in Delphi because CEF3 triggers the OnBeforePopup event in the IO thread. The next CEF3 version will trigger this in event in the UI thread so maybe this will be easier but, for now, I would try any other method to save files from javascript.
Try setting Result := True in the TChromium.OnBeforePopup event to cancel the popup creation.
Handling the popup windows is very complicated in Delphi because CEF3 triggers the OnBeforePopup event in the IO thread. The next CEF3 version will trigger this in event in the UI thread so maybe this will be easier but, for now, I would try any other method to save files from javascript.