<doc>
	<legacy_id></legacy_id>
	<name>revBrowserAddJavaScriptHandler</name>
	<type>function</type>

	<syntax>
		<example>revBrowserAddJavaScriptHandler <i>instanceID</i>, <i>handlerName</i></example>
	</syntax>

	<synonyms>
	</synonyms>

	<summary>Adds the named handler to the 'LiveCode' object within the current JavaScript context of the browser.</summary>

	<examples>
<example><p>local tBrowserID</p><p>put revOpenBrowserCef(the windowId of this stack, "http://www.runrev.com") into tBrowserID</p><p>revBrowserAddJavaScriptHander, tBrowserID, "myLiveCodeHandler"</p></example>
	</examples>

	<history>
		<introduced version="6.7">Added.</introduced>
		<deprecated version=""></deprecated>
		<removed version=""></removed>
		
		<experimental version=""></experimental>
		<nonexperimental version=""></nonexperimental>
	</history>

	<objects>
	</objects>

	<platforms>
		<mac/>
		<windows/>
	</platforms>

	<classes>
		<desktop/>
	</classes>

	<security>
		<network/>
	</security>


	<classification>
	</classification>

	<references>
		<function tag="revBrowserOpenCef">revBrowserOpenCef function</function>
		<command tag="revBrowserNavigate">revBrowserNavigate command</command>
		<command tag="revBrowserStop">revBrowserStop command</command>
		<command tag="revBrowserPrint">revBrowserPrint command</command>
		<command tag="revBrowserMakeTextBigger">revBrowserMakeTextBigger command</command>
		<command tag="revBrowserSet">revBrowserSet command</command>
		<command tag="revBrowserClose">revBrowserClose command</command>
		<command tag="revBrowserRemoveJavaScriptHandler">revBrowserRemoveJavaScriptHandler command</command>
		<message tag="browserOver">browserOver message</message>
		<message tag="browserNewInstance">browserNewInstance message</message>
		<message tag="browserDownloadRequest">browserDownloadRequest message</message>
		<message tag="browserNavigateCompleteFrame">browserNavigateCompleteFrame message</message>
		<message tag="browserNewUrlWindow">browserNewUrlWindow message</message>
	</references>

	<description>
	<overview>The  <b>revBrowserAddJavaScriptHandler </b>adds the named handler to the 'LiveCode' object within the currect JavaScript context of the browser.</overview>

		<parameters>
<parameter>
<name>instanceID</name>
<description>the ID of the browser instance returned by the revOpenBrowser function.</description> 
</parameter>
<parameter>
<name>handlerName</name>
<description>the name of a LiveCode handler in the script of the card / stack displaying the browser.</description> 
</parameter>		</parameters>

	<value></value>
	<comments>The <b>revBrowserAddJavaScriptHandler </b>function will make the named LiveCode handler visible to JavaScript within the browser as a function belonging to the global JavaScript 'LiveCode' object. Calling this JavaScript function will result in a call to the LiveCode handler, which will be passed the browser instance as the first parameter followed by any parameters given to the JavaScript function.<p></p><p><b>Example:</b></p><p>A LiveCode card has the following handler:</p><p></p><p>on myLiveCodeHandler pID, pArg1, pArg2</p><p>   answer "Browser ID" &amp;&amp; pID &amp;&amp; "called myLiveCodeHandler with arguments" &amp;&amp; pArg1 &amp;&amp; "and" &amp;&amp; pArg2</p><p>end myLiveCodeHandler</p><p></p><p>Registered within the JavaScript context with the following command:</p><p></p><p>revBrowserAddJavaScriptHander, tBrowserID, "myLiveCodeHandler"</p><p></p><p>The JavaScript code within the browser can then call the LiveCode handler via the registered function:</p><p></p><p>&lt;script ...&gt;</p><p></p><p>...</p><p></p><p>if (tIsRevBrowser)</p><p>&#9;liveCode.myBrowserHandler(tValue1, tValue2);</p><p></p><p>...</p><p></p><p>&lt;/script&gt;</p></comments>
	</description>
</doc>