Can I access LocalStorage from WiseJ?

0
0

In javascript, I can access LocalStorage

ex:

localStorage.setItem(“lastname”, “Smith”);

can I set and read from localstorage in wiseJ?

Thanks,
Shawn

  • You must to post comments
0
0

You can also use Application.Browser.LocalStorage, SessionStorage and CookieStorage.

https://wisej.com/docs/2.0/html/T_Wisej_Core_ClientBrowser.htm

  • You must to post comments
0
0

Thanks Jens.

I will try …

Best Regards

Marcelo Blank

 

 

 

  • You must to post comments
1
0

Hi Marcelo,

here is the LocalStorage example working with Wisej 2.

I had to delete the Window1.resx and let it re-create from VS. It got a compiler error some, which said there are “web restrictions” on this file.

I also set the Build Action of the JS-file to Embedded Resource and activate the line

[assembly: Wisej.Core.WisejResources(ExcludeList: "")]

in AssemblyInfo.cs.

After these steps the example is now working.

Best,

Jens

 

Attachment
  • You must to post comments
0
0

Hi Luca

I just get this example above (in WiseJ 1.5) and create it in WiseJ 2 … copying the JS and Component …

I got an initialize error… (Inspector/console).

Could you help me.

Follow a project.

Regards,

Marcelo Blank

 

 

 

  • You must to post comments
0
0

See attached local storage sample with component.

  • You must to post comments
0
0

See attached local storage sample with component.

  • You must to post comments
0
0

You can using javascript. We don’t pass the local storage back to the server since it could be quite large. You can execute any js method directly using Application.Eval().

My suggestion is to add your javascript functions in .js file(s) part of your project and use the methods from the app. You can create either global js functions or create a js object with your functions, like a namespace. Your javascript code can also call back your application on the server using [WebMethod], including methods in Program.cs or on a top level page or window.

I noticed that Application doesn’t have the Call method to be able to automatically serialize parameters, will add.

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.