Browser.eval

From GT-MP
Jump to: navigation, search
Browser.eval
Client-Side Function
System-users.png Client-Side Javascript.png JavaScript

browser.eval allows you to execute any javascript code contained in the string, just like Javascript's eval method.


Important! "browser" must be already defined and the CEF page must be fully loaded!

Syntax

In Javascript
Client-Side Function

browser.eval(String jscode);
  • jscode: javascript code to be executed on the HTML page. The parameter input should be in String type.

Usage example(s)

// Client-side .js script
browser.eval("document.getElementById('demo').innerHTML = 1;");
<!-- code in .html page, or .js file -->
<html>
    <body>
        <p id="demo">0</p>
    </body>
</html>


References