Problem with TTMSFNCWebBrowser.AddBridge

Hi TMS folks!

I am getting this error in TTMSFNCWebBrowser when attempting to use a JavaScript bridge object:

VM6:1  Uncaught Error: Element not found. (0x80070490)
    at RemoteMessenger.postSyncRequestMessage (<anonymous>:1:16942)
    at Function.getHostProperty (<anonymous>:1:33600)
    at Function._getAmbiguous (<anonymous>:1:20742)
    at Object.get (<anonymous>:1:23287)
    at saveNotes (sticky.js:154:58)
    at HTMLButtonElement.<anonymous> (sticky.js:81:9)
    at HTMLButtonElement.dispatch (jquery-3.6.4.min.js:2:43184)
    at y.handle (jquery-3.6.4.min.js:2:41168)

The project is here:

You can see the JS code here: sticky.js:154

And the bridge class here: PluginStorageService.pas:10

The bridge is added to the TTMSFNCWebBrowser instance on this line: FMX.BufferPanel.pas:263

And the JS layer is injected into the page here: FMX.BufferPanel.pas:164

Any help would be appreciated!

If you based your project on the latest version, we have changed it's creation behavior from synchronous to asynchronous which means that you need to wait until the OnInitialized event is triggered to access the browser. Please move this line:

TTMSFNCWebBrowser(FCommandControl).AddBridge('StorageService', FPluginManager.GetStorageService);

To the OnInitialized event implementation of the browser.