Rewrite content on the fly

How is it possible to rewrite website on the fly.
For example, when i use exeoutput as browser and browse other website, i would like to rewrite the source of this website by php script before display it.
I need it for something like cms for website i did. When anybode browse this website by regular browser chrome, firefox, opera it looks as it should look for enduser, but when owner of website browse by exeoutput application i need to rewrite it that he could edit and manage his website. How can i do it?

You should use a PHP script to download the HTML code from the website, modify the content you want and return it. Something like:
$ret = download(…)
// modify $ret
echo $ret;

is it only option? is it possible to you to enable option like this?
parse on the fly
css inject, js inject on the fly
regex string replace

in your answer if i use exeoutput as browser and browse another website, how can I catch url and use exeoutput it to render downloaded website, how to use it with cookies etc?

You won’t be able to modify browsed content, this would require a content filter and this is not available through PHP.

have you got any advice how to achieve it?

I had thought about this method some time back and found

Not even sure feasible and is still on my whiteboard under things to explore / try. When I read through their docs got impression it might work with API but never took it any further:)

Old Teacher thank you for your link, this soft is very nice, but my question was about something else.
I need to use something like ambasador pattern. You and gdgsoft could start to explore about this pattern here

I am asking developers for positive consideration of my request for the addition of real-time filtering and substitution of the html source. Please please please.

Found something interesting which can help you understand what i need :slight_smile:

My bad, was on my phone and missed your point on the small screen:)

GDG, is it possible to embed a browser extension with the Chromium browser engine that gets included with the exe file? With a browser extension, one could easily modify the page headers and/or content on the fly, with either background or content scripts.

No, browser extensions are only for Chrome. The CEF based on Chromium does not handle browser extensions yet.

I would also like to have such a feature! Directly accessing another website with javascript results in a CORS DomException, and somehow --disable-web-security --user-data-dir="C:\my\app" args for chromium do not work either.
It would be really great if we could just access a cross domain page with javascript.

@gdgsupport As the window.exeoutput object is automatically initiated on every page, maybe we can use that exeoutput object as a proxy / extension that can help us execute our JS code on the target cross-domain window?

I don’t know if this is still useful, but I have found a possible way to achieve this. Take a look at my original question thread here and its solution.

Basically, using --disable-site-isolation-trials --disable-web-security --user-data-dir flags in rendering engine property will disable the web security.

Then you can use javascript to manipulate cross-domain pages. For example,

var w =""); /*or any other crossdomain page*/
w.document.body.outerHTML = "<h1>Hello World!</h1>";

This will work as expected (normally this would throw a DomException).
You can use JS to modify / add new contents, change CSS or anything else you want.


That’s really great! On our side, we also found a way to execute JavaScript code after loading any website (including remote websites). This will be detailed after the incoming release of V2020.1.

1 Like


This is very useful for a project I have in mind… Where can I find the details, I’m using v2020.2 now.


Here is a code snippet (in HEScript). Copy/paste it into the UserMain script of your project:

procedure OnNavigateComplete(URL: String);
 S, S2: String;
 // When a page has been displayed.   
 S := "var p = document.createElement('p');
  p.textContent = 'Hello, Snippets!';
 ExecuteHTMLScript(S, "");                      

It will automatically execute the given JS code when the page has finished loading. In this code sample, we add a simple new paragraph to the body of any webpage displayed in the compiled app.

I gave this a try and I cannot get it to work. Your code probably works fine, but I can’t get anything to work at all inside the OnNavigateComplete event with ExeOutput v2020.2. See Previous post here OnNavigateComplete problems

Please try with the new patch posted Trouble with OnNavigateComplete