Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (34 sloc) 2.01 KB is a plugin for persistence.js and jQuery mobile that allows ajax request re-routing to persitencejs for:

  • Html text: caches ajax-loaded HTML pages in local DB.
  • Images (in img tags of ajax-loaded HTML pages): grabs/encodes them via canvas and caches them as data-URL strings in local DB.
  • Form submission (only POST requests).

For ajax-loaded HTML pages and images, the content-providing entities get their name from user-overwritable default values. For form submissions, the entity is matched according to the following URL pattern:

entity-name / path1/path2/../pathN

Ajax re-routing to persitencejs only takes place if the required entities exist.

Global settings (and it's default values): = "Page";    // Html page entity name = "Image";  // Image entity name = "path";         // Entity path-field name = "data";         // Entity data-field name

Optional Regular Expression to exclude URLs from re-routing to persistencejs:

Example: = /^\/admin\//; (all URL paths starting with "/admin/" are excluded)

Ajax page loading example:

URL: "about/intro.html"
=> entity name: "Page"
=> entity path field: "about/intro.html" 
=> entity data field: (the HTML content of the page)
Images: (all images contained in the page specified above)
=> entity name: "Image"
=> entity path field: (src attribute value of IMG tag) 
=> entity data field: (the imgae data as Base64 encoded dataURL)

Ajax form submission examples:

URL (POST): "order/response.html"
=> entity name: "Order"
=> entity fields (other than path): retrieved from POST data

You can find a demo at demo/jquerymobile/index.html (you must load it from a server).

Jump to Line
Something went wrong with that request. Please try again.