![]() ![]() |
GoFiler Legato Script Reference
Legato v 1.6e Application v 6.3a
|
| Table of Contents | < < Previous | Next >> |
Chapter Twenty-one — WebView Interface (continued)
JavaScriptAddTopLevel Function
Overview
The JavaScriptAddTopLevel function adds a JavaScript code segment that is executed on every page load.
Syntax/Parameters
Syntax
int = JavaScriptAddTopLevel ( handle hWVO, string code | wstring code );
Parameters
hWVO
A handle specifying a WebView Object.
code
A string or wstring specifying JavaScript code to execute.
Return Value
An int as ERROR_NONE (0) or a formatted error code on failure.
Remarks
The top level script is executed while the page is still navigating. Developers can use the top level script to determine when the page has finished loading. For example, the following JavaScript will post a “page loaded” message to Legato when the current page is finished loading.
function pageReadyHandler() {
window.chrome.webview.postMessage('page loaded');
}
if (document.readyState === 'complete' || document.readyState === 'interactive') {
setTimeout(pageReadyHandler, 1);
} else {
document.addEventListener('DOMContentLoaded', pageReadyHandler);
}
The data in this script is temporary as each loaded page will get a new copy of the script. To persist data between page loads use the JavaScriptSetMessageHandler function to send messages back to Legato and the JavaScriptRun function to add more data to the active page.
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Page revised 2025-10-20
| Table of Contents | < < Previous | Next >> |
© 2012-2025 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission is prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. Novaworks, GoFiler™ and Legato™ are registered trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are the property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.