Cache dynamic with javascript