Browser::execute

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

This function used for call JavaScript code in created browser.

Syntax

browser.execute(String executedCode);

Required Arguments

  • executedCode: JavaScript code what will be executed in browser.

Example

That's example made nothing useful:

browser.execute(`alert(\`It's a test.\`);`);

Get Chatbox status by executing code / check if open:

var isChatOpen = toggle;

mp.events.add('render', () => {
if (mp.game.controls.isDisabledControlJustReleased(0, 245)) {
    if (isChatOpen)
         return;
    mp.gui.execute("const _enableChatInput = enableChatInput;enableChatInput = (enable) => { mp.trigger('chatEnabled', enable); _enableChatInput(enable) };");
    }
}

See Also