clear DOM cache when clicking home button
The order of my pages goes like this : index.html-->news.html-->newstext.html. In my news.html page div, I enabled data-dom-cache="true" because when people come back from newstext, they are at the same page location and news.html is not refreshed.
news.html has a home button which takes it back to index where there are more topics to click on. How can I clear news.html from the dom when the home button is clicked?
- <head>
- <meta charset="utf-8"/>
- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
- <script>
- function clearDom(div){
- $(div).remove();}
- </script>
- </head>
- <body>
- <div data-role="page" id="mainNews" data-dom-cache="true">
- <div data-theme="b" data-role="header" data-position="fixed" data-tap-toggle="false">
- <a onclick="clearDOM('#mainNews');" data-role="button" data-rel="back" data-icon="home" data-iconpos="notext" class="ui-btn-left"></a>
- </div>
As you can see, I tried implementing the onclick method, trying to pass the divID of this page but it hasn't worked. The only topics I found deal with not caching at all. I want to cache until the user moves away from this page. I think this could be very helpful to others. Thanks for your time!
Just an update: From clicking around on the links in news.html, on my Android phone, under cache processes, my app caches anywhere from 20 to 30 MB. That's A LOT so I really need to clear that!