firefox下jquery iframe刷新页面提示会导致重复之前动作_jquery

WBOY
Release: 2016-05-16 17:46:18
Original
1491 people have browsed it

刷新页面会提示 “要显示此页面, Firefox 必须发送将会导致重复之前动作的数据(例如搜索或者下订单)”
看看以下代码

复制代码代码如下:

$("iframe").load(function(){
$(this).attr("src","about:blank");
})

框架打开后设置地址到一个空页面就可以避免这个提示
但有个问题 就是设置src后会触发load事件,会导致循环加载
所以需要设置一个参数 等触发完正常事件后 做一个标记
load完后判断一下
复制代码代码如下:

$("iframe[name=hi]").load(function(){
if ($(this).data("send")) {
$(this).attr("src", "about:blank").data("send",false);
}
})
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!