不太清楚该怎么称呼它,但这是我的抽象问题:
往复时,为什么有些浏览器不记得打开了什么而有些会?
例如,
鉴于以下情况:
html
<h2>» <a href="#" id="clickMe">Click Me</a></h2>
<div id="hiddenContent">
<h2> Meaty Filler </h2>
<p>
Bacon ipsum dolor sit amet deserunt venison dolor meatball laboris short loin dolore capicola prosciutto. Tongue cillum salami, drumstick strip steak do spare ribs ball tip proident short loin ullamco ex tempor. Fugiat labore in ut quis ribeye turducken pig beef. Corned beef ham proident, nisi adipisicing bresaola irure kielbasa pig. T-bone nisi ham hock consequat laborum est exercitation dolor shoulder biltong velit qui sunt. Ut chuck esse short ribs turducken, pork loin id.
</p>
<p>
Nulla sunt aute meatloaf drumstick pork. Drumstick deserunt capicola aliqua flank leberkas brisket consectetur. Pork belly meatloaf proident, deserunt tri-tip voluptate aliqua. Commodo minim consequat, shoulder tenderloin eiusmod laborum excepteur flank reprehenderit in.
</p>
» <a href="http://baconipsum.com/"> Get Me Some Bacon</a>
</div>
javascript/jquery
$('#clickMe').click(function(e) {
e.preventDefault();
$('#hiddenContent').fadeToggle();
})
css
#hiddenContent {display: none; border: 1px solid #ccc; background: #fcfcfc; padding: 1em; margin: 2em; border-radius: .25em; box-shadow: 2px 5px 10px #DBDBDB;}
#hiddenContent:hover { background: #FBFBFB; }
h2 { font: 1.5em/1.75em Georgia, serif; }
p { margin: 0 0 1em; font: 1em/1.25em Georgia, serif; text-align: justify; }
a { color: #444; text-decoration: none;}
a:hover { text-decoration: underline; color: #222; }
当我点击“给我一些培根”并点击后退按钮时,铬和 IE8 将不记得它#hiddenContent
是打开的,不再隐藏,但 Firefox 会。理想情况下,我更愿意模仿 firefox 的行为,但不确定我是否能够。这可能吗?
这是一个不工作的jsfiddle。当您回击时,jsfiddle 会显式重新加载页面,但在我的(基于 struts - java 的)Web 应用程序中,我已将响应设置为显式缓存。