html5 session storage

I have 2 pages, 1st contains a div and 2nd page contains some image.I have a functionality that if user clicks on any image in 2nd page, the page redirects to 1st page and the selected image should come in the div on the 1st page.

How can this be achieved via HTML5 Session Storage??

Answers


Before taking the user to the first page, set sessionStorage.imageclicked = [whatever image was clicked here]. Then, get that value and use it to show the image.

May I ask, though, why don't you just use a normal link?

http://example.com/firstpage.ext?image=[whatever image was clicked]

This is supported in even the oldest of browsers.


Need Your Help

Can Product_ID of products in Opencart be alphanumeric?

php opencart2.x ebay-api openca

I am working on a project where I am trying to check some validations but I find a risk of 'product_id' parameter is not properly sanitized upon submission to the index.php script, which can disclo...