在 jquery.simplemodal 中使用 iframe,当弹出窗口关闭时 iframe 会重新加载
var pt_popup_options = {};
function pt_popup_iframe(sURL, sOkFunction)
{
pt_popup_okfunction = sOkFunction;
$("#pt_msgBox").css('width', '700px');
$("#pt_msgBox").css('heigth', '500px');
$("#pt_msgBox > p").html('<iframe style="width: 696px; height: 496px;" src="' + sURL + '"></iframe>');
$("#pt_msgBox").modal(pt_popup_options);
}
当通过关闭按钮或弹出窗口右上角的“x”关闭弹出窗口时,iframe 会重新加载并向服务器发出请求。它不应该这样做。有什么想法可以防止这种情况发生吗?我使用的是 Chrome 和 jQuery 1.4.2。
谢谢你!
var pt_popup_options = {};
function pt_popup_iframe(sURL, sOkFunction)
{
pt_popup_okfunction = sOkFunction;
$("#pt_msgBox").css('width', '700px');
$("#pt_msgBox").css('heigth', '500px');
$("#pt_msgBox > p").html('<iframe style="width: 696px; height: 496px;" src="' + sURL + '"></iframe>');
$("#pt_msgBox").modal(pt_popup_options);
}
When the popup is closed via a close button or the "x" top right of the popup, the iframe reloads and make a request to the server. It is not supposed to do that. Any idea to prevent that? I'm on Chrome and jQuery 1.4.2.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也有同样的问题。
修复此问题的最简单方法是设置
persist
选项。$("#pt_msgBox").modal({persist:true});
从 simplemodal-1.3.5 开始
I had the same problem.
Easiest way to fix it is to set the
persist
option.$("#pt_msgBox").modal({persist:true});
As of simplemodal-1.3.5
如果您使用 jQueryUI 的对话框,还有另一种选择,我不久前编写了一个扩展来处理对话框中的各种 iFrame 问题...
http://plugins.jquery.com/project/jquery-framedialog
Another option if you're using jQueryUI's dialog, I wrote an extension a while ago that handles the various iFrame issues within a dialog...
http://plugins.jquery.com/project/jquery-framedialog
似乎适用于:
Seems to work with: