javascript - mithril avoiding to reload image -
i using mithril 0.2.2-rc.1. saw in routing documentation: routing system allows creating single-page-applications (spa), i.e. applications can go 1 page without causing full browser refresh.
indeed when routing same page different parameter part want change refresh expect :
m("img[src='assets/images/logo.png'][alt=''][width='100']")
i can see in network communication image reloaded (another request).
is there way avoid that?
route.js
m.route.mode = "pathname"; m.route(document.getelementbyid('app'), '/', { '/': main, '/modelling/:level': main })
it's difficult see how 2 pieces of code fit together, 2 things suggest themselves:
- every change of route (even if change results in same route entry, eg
/modelling/x
/modelling/y
) result in entire dom being regenerated. can prevent behaviour callingm.redraw.strategy( 'diff' )
in each route component's controller. - repeatedly requesting same resource not lead calls server: multi page site every page requesting same js , css load resources once, , hit browser cache on subsequent requests. repeatedly asking same image resource not generate new calls server.
Comments
Post a Comment