This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
token:FrontBrowserJavaScript [2017/09/05 01:26] peternlewis |
token:FrontBrowserJavaScript [2023/09/13 00:28] peternlewis |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | The //%FrontBrowserJavaScript%document.forms[0].innerHTML%// token (v8+) returns the result of some JavaScript executed in the active tab of the front browser (the most recently front web browser of Safari or Google Chrome). | + | ====== FrontBrowserJavaScript (v8+) Token ====== |
+ | |||
+ | The FrontBrowserJavaScript token (and related SafariJavaScript and ChromeJavaScript tokens) provides a quick and simple means to execute one line of JavaScript in a Web Browser and return the results to an action like the [[action:Set_Variable_to_Text|Set Variable to Text]] action. | ||
+ | |||
+ | The execution time is limited (v11.0+) to half a second, so for longer or more complex JavaScript code, use the [[actions:Execute_a_JavaScript_in_Browser|Execute JavaScript in Front Browser]] action instead. | ||
+ | |||
+ | The front browser will be the most recently front Safari-like or Chrome-like web browser. | ||
+ | |||
+ | ===== Format ===== | ||
+ | |||
+ | Like all [[:Tokens|Tokens]], this token uses `%` to denote it as a token, and to separate the root token from its parameter, a single line of JavaScript:\\ | ||
+ | `%FrontBrowserJavaScript%<One Line of JavaScript>%` | ||
+ | |||
+ | ===== Examples ===== | ||
+ | |||
+ | ==== 1. Get All Text on Web Page ==== | ||
+ | |||
+ | `%FrontBrowserJavaScript%document.body.innerText;%` | ||
+ | |||
+ | ==== 2. Get Full Page HTML ==== | ||
+ | |||
+ | `%FrontBrowserJavaScript%document.getElementsByTagName("html")[0].outerHTML;%` | ||
+ | |||
+ | ==== 3. Get Text Identified by HTML tag and class ==== | ||
+ | |||
+ | `%FrontBrowserJavaScript%document.querySelector('div.someclassname').innerText;%` | ||
===== See Also ===== | ===== See Also ===== | ||
Line 6: | Line 32: | ||
* [[token:SafariField|%SafariField%]] | * [[token:SafariField|%SafariField%]] | ||
- | * [[token:SafariJavaScript|%SafariJavaScript%]] | ||
* [[token:SafariReadyState|%SafariReadyState%]] | * [[token:SafariReadyState|%SafariReadyState%]] | ||
* [[token:SafariTitle|%SafariTitle%]] | * [[token:SafariTitle|%SafariTitle%]] | ||
* [[token:SafariURL|%SafariURL%]] | * [[token:SafariURL|%SafariURL%]] | ||
* [[token:ChromeField|%ChromeField%]] | * [[token:ChromeField|%ChromeField%]] | ||
- | * [[token:ChromeJavaScript|%ChromeJavaScript%]] | ||
* [[token:ChromeReadyState|%ChromeReadyState%]] | * [[token:ChromeReadyState|%ChromeReadyState%]] | ||
* [[token:ChromeTitle|%ChromeTitle%]] | * [[token:ChromeTitle|%ChromeTitle%]] | ||
* [[token:ChromeURL|%ChromeURL%]] | * [[token:ChromeURL|%ChromeURL%]] | ||
* [[token:FrontBrowserField|%FrontBrowserField%]] | * [[token:FrontBrowserField|%FrontBrowserField%]] | ||
- | * [[token:FrontBrowserJavaScript|%FrontBrowserJavaScript%]] | ||
* [[token:FrontBrowserReadyState|%FrontBrowserReadyState%]] | * [[token:FrontBrowserReadyState|%FrontBrowserReadyState%]] | ||
* [[token:FrontBrowserTitle|%FrontBrowserTitle%]] | * [[token:FrontBrowserTitle|%FrontBrowserTitle%]] | ||
* [[token:FrontBrowserURL|%FrontBrowserURL%]] | * [[token:FrontBrowserURL|%FrontBrowserURL%]] | ||
+ | * [[token:FrontBrowser|%FrontBrowser%]] | ||
+ | * [[token:FrontBrowserBundleID|%FrontBrowserBundleID%]] | ||
+ | * [[token:FrontBrowserPath|%FrontBrowserPath%]] | ||
* [[:Tokens|See all Tokens]] | * [[:Tokens|See all Tokens]] | ||
+ |