Open dongle-the-gadget opened 2 years ago
Hey @dongle-the-gadget - I just gave this a try and localStorage is showing up fine for me on a 99.0.1150.46. Are you navigating to that page in a special way? Can you share a sample app that demonstrates this issue? Thanks!
Discord intentionally destroys the localStorage object so automated scripts cannot set the token localStorage object, which would grant them access to user accounts.
Thanks for the info @LingleDev. So I guess the ask here is to expose the localStorage API when the page purposefully hides the API? It's possible you can do this today using Chromium Devtools Protocol: https://chromedevtools.github.io/devtools-protocol/tot/Storage/
And call it on the WebView2: https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.calldevtoolsprotocolmethodasync?view=webview2-dotnet-1.0.1264.42#microsoft-web-webview2-core-corewebview2-calldevtoolsprotocolmethodasync(system-string-system-string)
Description
The
localStorage
JavaScript API seems to be completely missing. Using either DevTools console orCoreWebView2.ExecuteScriptAsync
always results in the error sayinglocalStorage
is undefined.Version
SDK: 1.0.1150.38 Runtime: Stable 99.0.1150.39 Framework: WPF OS: Windows 11 Insider Build 22572
Repro Steps
localStorage
. Expected result: DevTools shows the JSON implementation oflocalStorage
. Actual result: DevTools throwsUncaught ReferenceError: localStorage is not defined
.CoreWebView2.ExecuteScriptAsync("javaScript:localStorage");
Expected result: The function returns the JSON implementation oflocalStorage
. Actual result: The function returns null.Screenshots