<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/HU/executeBrowser?action=history&amp;feed=atom</id>
	<title>HU/executeBrowser - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/HU/executeBrowser?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=HU/executeBrowser&amp;action=history"/>
	<updated>2026-04-13T21:45:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=HU/executeBrowser&amp;diff=57158&amp;oldid=prev</id>
		<title>Surge: Created page with &quot;__NOTOC__ {{Client function}} {{New feature/item|3.0150|1.5|| This function executes a Javascript string to the specified browser. Works only with local br...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=HU/executeBrowser&amp;diff=57158&amp;oldid=prev"/>
		<updated>2018-07-30T11:00:43Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ {{Client function}} {{New feature/item|3.0150|1.5|| This function executes a Javascript string to the specified &lt;a href=&quot;/wiki/Element/Browser&quot; title=&quot;Element/Browser&quot;&gt;browser&lt;/a&gt;. Works only with local br...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0150|1.5||&lt;br /&gt;
This function executes a Javascript string to the specified [[Element/Browser|browser]]. Works only with local browsers.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool executeBrowserJavascript ( browser webBrowser, string jsCode )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Element/Browser|browser]]:executeJavascript}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''webBrowser:''' The web browser which will execute the Javascript code&lt;br /&gt;
*'''jsCode:''' The Javascript code string&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if executing Javascript is allowed in the current context, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example shows how to display the name (nick) of the local player on the webpage.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local browser = guiGetBrowser(guiCreateBrowser(200, 200, 400, 200, true, false, false))&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onClientBrowserCreated&amp;quot;, browser,&lt;br /&gt;
    function ()&lt;br /&gt;
        loadBrowserURL(source, &amp;quot;http://mta/local/example.html&amp;quot;) --Containing &amp;lt;span id=&amp;quot;nick&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; somewhere in the file&lt;br /&gt;
    end)&lt;br /&gt;
&lt;br /&gt;
--The page has to load first&lt;br /&gt;
addEventHandler(&amp;quot;onClientBrowserDocumentReady&amp;quot;, browser,&lt;br /&gt;
    function ()&lt;br /&gt;
        executeBrowserJavascript(source, &amp;quot;document.getElementById('nick').innerHTML = '&amp;quot; .. getPlayerName(localPlayer) .. &amp;quot;'&amp;quot;);&lt;br /&gt;
    end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{CEF_functions}}&lt;br /&gt;
&lt;br /&gt;
[[en:executeBrowser]]&lt;/div&gt;</summary>
		<author><name>Surge</name></author>
	</entry>
</feed>