Exception
Exception

Reputation: 8379

How to store a Web page in localStorage to view at any time

I have a online web application form which I have to open every time and have to fill data and Submit.. So, I have got an idea of making a Google Chrome extension, that will make that page stored inside localStorage So that I can access it like a desktop page.. Is this possible.. I do not have any permissions to change the web site at server side.. I am just a client side programmer.. Is it possible? if yes please let me know how can I achieve this..

Upvotes: 1

Views: 162

Answers (1)

japrescott
japrescott

Reputation: 5025

in theorie, yes, you could. Practically, it won't work out like you want. The reason are the external resources the website is going to be needing. Storing just the html (document.body.innerHTML) would be possible. BUt if you want the formatting/layout to be happening, you'd need to save the computedStyles for each element as well. And if an image, you'd need to Base64 encode the image and save it. Even if you'd succeed in saving the page, you'd need to know when to expire your localStorage cache and refetch the resources to stay compliant to the server side parsing of the form data (if they'd change something).

if its just about submitting a form, you also could just trigger the forms post-action-url directly by writing a script that resends the data you want sent.

Upvotes: 2

Related Questions