Memory effect
Remember pages already loaded!
– If a page has been visited already and is re-visited, it is there instantly.
– Especially applies to the clicking of the “back button”
Default: memoryoff: false
To turn off, please set to true
, or supply hints (substrings delimited with “, ” i.e comma and space) to selectively turn off e.g.:
memoryoff: "dyna, product"
…will selectively turn off the memory effect for pages that contain “dyna” or “product” in the URL.
– You might want to do that, if your site has pages that expect to be refreshed dynamically…
The memory cache can be flushed as follows:
ajaxify.cache1("f");
(You might want to perform a cache flush e.g. once the user has logged out…)
Goes hand in hand with the prefetch and preview effects
Hi Arvind,
I am looking for a way to check if a page has already been cached.
Within pronto.request I load a query plugin showing a loading progress bar. It would be find to check if the target page has already been loaded so I would prevent the loading indicator from showing.
Any idea? Thanks, Patrick
Hi Patrick,
you should be able to do the following:
if($.pages(url)) { ... //page is in cache}
(
$.pages(url)
returnsundefined
if not cached)Tested new cache (6/6/14), error after deleting cache on line 360:
“lk = head.find(“.ajy-link”);”
Uncaught TypeError: Cannot read property ‘find’ of undefined.
seems like $.getPage(“head”) returns undefined because the if state you added after deleting the cache.
I fixed the problem by adding:
else {
return $(o);
}
after line 160.
its working now but after deleting cache and loading page its loads the page with no head (no css and js) and then after the page have been loaded you can see the head injection.. looked badly 😀
Hi Ariel!
Thanks for testing this new feature further!
It’s a pity it doesn’t work straight away, but that is probably normal for a new feature…
Do you have any idea, what the correct algorithm would look like?
I have the weekend off, so I could dedicate it to fixing this bug in the new feature / finding the correct algorithm…
Just thinking out loud – maybe it is not correct to fully empty the cache.
Would it be alright to use your site as a testbed?
If you don’t want that, then maybe you could post the link via eMail (arvgta@gmail.com) and I’ll treat it discretely.
If you don’t want that either, I could use my partner site: http://www.oeko-fakt.de as a testbed instead.
Sorry about the inconvenience so far, but it is not a trivial addition…
Bug Found: when you use $(this).html the browser will replace & in the javascript inline code into & which will bring to js errors, try to use $(this).text insted. (worked for me).
another issue, I found no way to empty the cache/memory, and I would like to do so in some cases.
Hi Ariel,
I’ve added a new method:
$.cache("f")
for you… (stands for “flush”)
Please test!
Regarding the other issue – which line of code do you mean in “Ajaxify“?
wow, you are fast!
for the entites bug:
line 179 and 305, both made errors for me for coverting & in inline javascript into &.
and for the new flush cache made an error after cleaning cache:
Uncaught TypeError: Cannot read property ‘find’ of undefined. (line 159 in ajaxify.js)
Hi Ariel,
Changed line 159.
Also replaced
$(this).html()
with
$(this).text()
on lines 179, 305 and 312
Could you re-test please – thanks!
how can i empty the cache (for example after login/logout has happend).
Hi Arvind,
Great plugin! I’ve got it working.
How can I flag a page NOT to be cached in plugin ‘memory’. I have pages that need to run a query and display updated data each time the page is hit. So far, the only way I have found to get the ‘updated’ query results to display on the page is to refresh the page but that’s not a good solution.
Thanks,
Bob
Hi Bob!
Thanks for the great idea! Implemented! (please see description on this page)
Please test, as I think it’ll work but haven’t tested it yet…
Regards, Arvind