+1
Аяқталған

CSS and HTML Caching in Web View

Ryan Doll 11 year бұрын 0
When using a panel for multiple static HTML pages, you will find out quickly that the iOS UIWebView class will cache as much as possible. This would include your css files that you might change during a new snapshot. An easy way to allow all of your HTML pages to pull in your css file change without adjusting all your files is to dynamically load your css file, with a query string parameter and random number at the end. Below is a small snippet that you can use in a script block at the end of your body tag.

var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'css/styles.css?rand=' + Math.random();
document.getElementsByTagName('head')[0].appendChild(link);

Enjoy!