Mahmoud Mabrouk
Mahmoud Mabrouk

Reputation: 733

framework7 prevent caching pages data

i want to prevent all the app`s pages cache in Framework 7. is there any option i can add here

var myApp = new Framework7({
        material: true //enable Material theme
    })

or a function that can make me stop caching permanently.

Upvotes: 1

Views: 6416

Answers (3)

aecsahin
aecsahin

Reputation: 31

for preventing cache you can use inline method (data-page attribute)

data-ignore-cache="true"

<a href="#" data-ignore-cache="true"><i class="fa fa-calendar"></i> sample link</a>

Upvotes: 2

Aysad Kozanoglu
Aysad Kozanoglu

Reputation: 1

The simplest way is to define a variable timestamp and set it with Date.now() and give it to route path parameter with ?timestamp on every route path ending.

So in this case framework7 must load every html file on every browser reload again.

after your development and design is finished you can comment it out. This scenario you can use for every framework you use. it is not framework7 specific.

for examle:

var timestamp   = Date.now();

routes = [
  {
    path: '/',
    url: './index.html?'+timestamp,
  },
  {
    path: '/about/',
    url: './pages/about.html?'+timestamp,
  },
  {
    path: '/form/',
    url: './pages/form.html?'+timestamp,
  },
  {
    path: '/page-loader-template7/:user/:userId/:posts/:postId/',
    templateUrl: './pages/page-loader-template7.html?'+timestamp,
  },
  {
    path: '/page-loader-component/:user/:userId/:posts/:postId/',
    componentUrl: './pages/page-loader-component.html?'+timestamp
  }]

Upvotes: 0

Federico Massi
Federico Massi

Reputation: 361

You may set cache: false as in

var myApp = new Framework7({
    cache: false /* disable caching */
})

or (if it's fitter for your application) you may set its duration to zero setting cacheDuration: 0 as in

var myApp = new Framework7({
    cacheDuration: 0 /* set caching expire time to 0 */
})

You can refer to http://framework7.io/docs/init-app.html for more detailed specs.

Upvotes: 6

Related Questions