{Dynamics CRM web resource} Using HTML 5 session storage feature in Dynamics CRM web resources

Looking at the title of the topic, you must be wondering, is it something really related to Dynamics CRM. Well I would say a big Yes. Because it is an excellent HTML 5 feature and we develop HTML 5 webresources in our day-day activities. Being a dynamics crm consultant we sometimes  tend to miss out on some cool stuffs outside our CRM universe. For those who have missed out this one, I bet you would love it.

Many a times when we open a HTML webresource on the click of a ribbon button or some element click on the CRM entity form, we tend to pass parameters to the webresource. And sometimes we need to persist the value of the parameter in the webresource even if the webresource is refreshed.

Well you can use the cool HTML 5 feature of sessionStorage.

The sessionStorage persists as long as the browser window is open and gets deleted once you close the browser tab/ window. Another cool stuff about this is that it follows the standard key/ value model of storing the value just like any modern language.

Below is the sample code of how to set and get values from the sessionStorage.

 

image

It will persist your page refresh and unlike cookies it does not get posted to the server every time you submit your page.

Hope this helps!

Advertisements

One thought on “{Dynamics CRM web resource} Using HTML 5 session storage feature in Dynamics CRM web resources

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s