Closed Priyalakshmi193 closed 1 week ago
CefSharp Version
117.2.20
This is an old unsupported version. Does the problem reproduce with the current supported version? (M129 at time of writing).
I'm using CefSharp to bind objects via currentBrowser.JavascriptObjectRepository. The object is correctly bound and accessible on the initial page, but when I navigate to a new page in the same browser instance, the object becomes undefined. I'm using a custom life span handler to handle new page creation and re-register the object, but the issue persists.
Please no images of code see https://idownvotedbecau.se/imageofcode
Does the problem reproduce using the MinimalExample? You can fork the MinimalExample and use this as a base for your example.
Please fork the MinimalExample
and create an example that reproduces the problem. Keep the example to just the base minimum of code required to reproduce the issue. Push a copy of your branch to GitHub
.
Alternatively create a failing unit test. There are already some that could be used as a base.
Closing due to lack of feedback
Is there an existing issue for this?
CefSharp Version
117.2.20
Operating System
Windows 10
Architecture
x64
.Net Version
.NET 4.8
Implementation
WinForms
Reproduction Steps
I'm using CefSharp to bind objects via currentBrowser.JavascriptObjectRepository. The object is correctly bound and accessible on the initial page, but when I navigate to a new page in the same browser instance, the object becomes undefined. I'm using a custom life span handler to handle new page creation and re-register the object, but the issue persists.
Register CallbackObj in Mainform.
Re-Register the CallbackObj in CustomLifeSpanHandler
Expected behavior
The registered object should be accessible after opening a new page.
Actual behavior
The registered object is undefined after opening a new page.
Regression?
No response
Known Workarounds
Delay Method Calls: Add a slight delay before calling the JavaScript object to ensure it’s fully registered. You can use setTimeout in JavaScript to introduce a small pause.
Check Frame Load Event: Ensure that JavascriptObjectRepository is re-registered after each new page load, especially in multi-frame scenarios. Handle this in the FrameLoadEnd event.
Does this problem also occur in the CEF Sample Application
Yes using WPF/OffScreen command line args
Other information
No response