标签:
火狐弃用http,转而大力推广https的动作一石激起千层浪,很多没有安装安全证书的网站使用新版火狐浏览器已经打不开了。之前我们网站只有涉及需要加密的部分连接为https协议,目前看来不得不将整个网站的连接均加装https。原本运行正常的功能就这样出现了问题。详细情况是,产品列表页面使用ajax加载产品的时候不能再像从前那样缓存之前加载好的数据了。造成这种情况的原因主要有两点,第一点是在后台设置的过滤器强制每个页面不缓存内容,第二个原因便是因为整个网站都进行了安全加密,使得浏览器本身不会再进行页面缓存。解决这个问题的方法是在需要缓存数据的页面设置强制缓存,如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> <% String path = request.getContextPath(); int nMinutes = 60 * 24 * 7; Date d = new Date(); String modDate = d.toGMTString(); String expDate = null; expDate = (new Date(d.getTime() + nMinutes * 60000)).toGMTString(); response.setHeader("Last-Modified", modDate); response.setHeader("Expires", expDate); response.setHeader("Pragma","public"); response.setHeader("Cache-Control","public"); %> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <link href="<%=path%>/resources/weixin/css/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<%=path%>/resources/weixin/js/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="<%=path%>/resources/weixin/js/progressbar.js"></script> <script type="text/javascript" src="<%=path%>/resources/weixin/js/common.js"></script> <script type="text/javascript" src="<%=path%>/resources/weixin/js/account.js"></script> <script type="text/javascript" src="<%=path%>/resources/js/common.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#investpage").addClass("current"); if(isWeiXin()){ $("#page").val("1"); } addMoreProducts(); }); </script> <title>普惠理财-产品列表</title> </head> <body> <header id="header"> <h3>产品列表</h3> </header> <div id="container"> <form id="centerForm" name="centerForm" method="post" action=""> <input type="hidden" id="page" name="page" value="1" /> </form> <div id="proList" class="pro_list"> </div> <div id="addTag " class="addTag"> <a href="javascript:void(0)" onclick="addMoreProducts()"> <span id="loading" class="icon"></span><span id="promtText">加载中...</span> </a> </div> </div> <footer id="footer"> <jsp:include page="../footer.jsp" /> </footer> </body> </html>
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/a1314517love/article/details/46863953