English 中文(简体)
Firefox 按住后键时记得的文档修改
原标题:Document modifications remembered by Firefox when back button pressed

当提交表格时, 我将显示一个装入动画并禁用按钮。 不幸的是, 当我单击后键时, Firefox 仍然显示装入图像, 而按钮仍然禁用。 这在铬中不会发生 。 有什么想法吗?

$(document).ready(function() {
    $( #go ).removeAttr( disabled );
    $( #loading ).replaceWith( <img id="loading" src="/static/images/loading.gif" style="display:none; vertical-align:middle" /> );

    $( #go ).click(function(e) {
        e.preventDefault();
        $( #go ).attr( disabled ,  disabled );
        $( #loading ).show();
        $( #go_form ).submit();
    });
});
最佳回答

Firefox 在浏览器会话中对整个网页,包括其 JavaScript 状态使用模拟缓存。 被访问的页面之间向后和向前不需加载页面。 此功能使得页面浏览速度非常快 。

为了检测此选项, 请使用 < code> pageshow 事件。 该事件将包含一个名为 < code> persisted 的属性。 如果您正在浏览缓存, 将会是真实的 。 如果您看到此状态, 您可以重置页面状态 。

问题回答

这可能是由于在铬和Firefox中存在不同的缓存机制。一个简单的方法就是将装入图像隐藏在 onunload 事件中。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签