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.

How to Pause and Resume Javascript Execution

Post Reply
wbdeveloper
Posts: 18
Joined: Sun Jul 18, 2021 9:56 pm

How to Pause and Resume Javascript Execution

Post by wbdeveloper »

Hello Salvador, how are you?

Can you tell me if it is possible to manage Javascript
when we run using the Chromium.ExecuteJavaScript() method?

I need some way to Pause, Resume and Cancel Javascript Execution

With DevTools there is such a solution, but in my tests it didn't work
https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#method-terminateExecution

Do you know any workaround for this?

Thanks!
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to Pause and Resume Javascript Execution

Post by salvadordf »

Hi,

Not all the DevTool methods are supported by CEF/Chromium.

You can try setting TChromiumCore.JavascriptEnabled to False and then call TChromiumCore.UpdatePreferences.
Setting that property to false will disable ALL JavaScript in that browser.

If you control the code in that script then I would suggest that you search "stop javascript execution".
https://stackoverflow.com/questions/9298839/is-it-possible-to-stop-javascript-execution
https://stackoverflow.com/questions/550574/how-to-terminate-the-script-in-javascript
https://code-boxx.com/abort-javascript-execution/
wbdeveloper
Posts: 18
Joined: Sun Jul 18, 2021 9:56 pm

Re: How to Pause and Resume Javascript Execution

Post by wbdeveloper »

thank you salvadorf
Using TChromiumCore.JavascriptEnabled solved my problem
Have a good day :D
Post Reply