How do I manually clear cache for webview in Chrome app? - caching

I am developing a Chrome app that shows some web content in a webview tag. The content is being cached. When I edit the content files, clearing Chrome browsers' cache does not seem to actually clear the webview cache.
One of the posts recommends to assign a unique partition ID every time Chrome app starts.
Changing partition ID on the webview does help to clear (or re allocate) the cache, but I still would like to take advantage of caching 3MB of web content and clear it manually only if it changes.
Is there a way to clear that cache, in particular on Chrome OS?

This has since been implemented and is available in Chrome 43+
webviewElement.clearData({}, {cache: true}, function() {
// Cache cleared
});

Related

How to clear cache in Sitecore

I updated the RichText commands.js file under /sitecore/shell/controls/rich text editor.
I have copied it to the production environment, but my change isn't being applied. I am guessing JS is cached - how do I clear the cache? Site doesn't require a publish since content items weren't updated. Cleared the cache at /sitecore/admin/cache.aspx too.
Browser caching cleared. Recycled the app pool and restarted the website as well.
Sitecore 7.2
The javascript is cached in your browser not in Sitecore. Depending on your browser you can clear it from the toolbox (all of them have a clear cache option) or use the following shortcuts:
Firefox, Chrome, IE: Ctrl+Shift+Delete
Safari: Ctrl+Alt+E
This is a browser caching.
A common solution is to add a ? to the script's src link.
For instance:
you can modify
Website\sitecore\shell\Controls\Rich Text Editor\Default.aspx
and
\Website\sitecore\shell\Controls\Rich Text Editor\EditorPage.aspx
to have:
<script type="text/javascript" language="javascript" src="/sitecore/shell/Controls/Rich Text Editor/RichText Commands.js?v=152605"></script>
Also you can open your browser in incognito mode or to delete browser cache

Is it possible to programmatically reload JavaScript files in mobile browsers on page refresh?

I am developing a web application and while working on a desktop, I am used to force reloading pages using Ctrl-F5 in the browser to clear any cached copies when I make changes to javascript files.
I am not able to do that in mobile browsers since they don't have a Ctrl-F5 or forced reload feature. I want to refrain from using version numbers in the javascript's querystrings to force a reload files whenever I make changes.
Is there any client-side or server-side way to force a mobile browser to refresh javascripts when reloading a webpage?
Sure. The following method can be used to load in a JavaScript file programmatically.
function LoadJsFile(jsUrl)
{
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", request);
document.body.appendChild(script);
}

Any firefox plugin that can cache entire page and load it when accessed using url

I am looking for a firefox plugin that can store entire page in cache and load it when ever that address is typed, and only load content from server if we press reload cache or similar functionality.
My usecase is, I use documentation of Laravel, Bootstrap, Jquery etc on regularly based but each time I am accessing it from the internet, these pages do not have any changes for many days. I dont want to store the webpage as file and access it, I would love to do it in comfort of your web browser than opening files.
I think firefox already does this. Load a page in a tab, then go to top left firefox menu > developer > work offline.
Reload that page in tab its from cache.
If you ever go work offline it loads from cache.

Persistant Chat Window? Like Facebook or OkCupid

I saw this question asked here 18 months ago, but without (a correct) answer: Window like facebook chat
Both Facebook and OkCupid have messaging windows which stay open even when you click to another page on their website. Literally the IM window (and friend list, on Facebook) don't so much as flash or "blink" as if they were reloading quickly. If you refresh the website (F5 or such) then the messages will disappear, at least for a moment.
The only thing I can think of is that the entire website never actually changes addresses, but just pushes the new URLs to your browser so it looks like the URL changed, but you never really left the same file.
How are they offering this persistent chat?
My guess is they are using something similar to qjuery-pjax:
https://github.com/defunkt/jquery-pjax
From their docs:
pjax works by grabbing html from your server via ajax and replacing the content of a container on your page with the ajax'd html. It then updates the browser's current url using pushState without reloading your page's layout or any resources (js, css), giving the appearance of a fast, full page load. But really it's just ajax and pushState.
This means clicking a link on the page will load only part for page and leave the chat windows untouched (no flicker). If you hit F5, the browser is initiating the refresh which will not use ajax/pushState. This causes the chat windows to flicker.

How to clear local storage values in Internet Explorer 8

I'm using IE8 and the jstorage library to store data in place of cookies. This is all good until i want to clear the stored values. In chrome this is possible by navigating to the content settings page. However in IE8 it only provides an option to clear cookies which doesn't clear the values I've stored in local storage.
Any ideas how i can clear this data? I don't want to display a "clear cache" button
Try localStorage.clear() in Console panel of IE Developer toolbar. It returns an "undefined" but seems to clear local storage.
It is worth mentioning that this function only clears the localStorage of the domain of the current window, not all localStorage values for the browser.
Example: (IE8 issue) If you're website is loading external content within an iFrame, localStorage.clear() won't clear that domain inside of the iFrame unfortunately.
This was an issue with local storage support in IE8. The cache does not remove local storage so instead need to call the following from the developer tools console
$.jStorage.flush()

Resources