I am developing Windows phone 7.1 PhoneGap app. I would like to remove localstorage which was created by window.localStorage.setItem
JavaScript code in C#. I know, in JavaScript we can remove using window.localStorage.removeItem
. But, I want to remove from code behind C#. Any help is appreciated.
Asked
Active
Viewed 6,571 times
1
-
Are you using a WebBrowser control? http://stackoverflow.com/questions/153748/how-to-inject-javascript-in-webbrowser-control – sq33G Jun 13 '13 at 12:00
-
I tried WebBrowser, But some unknown error occurs with exception. – Jun 13 '13 at 12:03
1 Answers
6
Use this code,
ScriptManager.RegisterStartupScript(this, GetType(), "YourUniqueScriptKey",
"localStorage.removeItem(key);", true);
note: local storage is a client side and C# is serverside. so simple you cannot access client side items with c#. but in above code it will run a javascript code in the first page load after your c# event.

Chamika Sandamal
- 23,565
- 5
- 63
- 86
-
-
that is also not supported in Windows phone 7.1 app. I came across both of them already and tried them. – Jun 13 '13 at 11:53
-
-
if this one also not working, better to ask new question and tag windows phone app then people have knowledge about it will reply – Chamika Sandamal Jun 13 '13 at 11:58