JLPluginCookies
A Jasonelle plugin that stores a cookie string in the iOS keychain and restores it into the web view.
Overview
JLPluginCookies keeps a single cookie string (e.g. session=abc; Path=/) in the iOS keychain so it survives app restarts. JavaScript saves the current web view cookies with persist(), stores an explicit string with save(value), and restores them with restore(), which also injects the value into the web view’s cookies after the DOM has loaded.
Structure
| File | Role |
|---|---|
|
Native side – saves and reads the cookie string from the iOS keychain. |
|
JavaScript side – registers the plugin on |
How it works
-
The plugin is injected into the web view at document end and registers itself on
window.jasonelle.plugins.cookies. -
persist()captures the current cookies withdocument.cookieand stores them in the iOS keychain. -
save(value)stores an explicit cookie string in the iOS keychain. -
restore()reads the string from the keychain and sets it viadocument.cookieonce the DOM is loaded, then resolves with the value.