我在我的项目中使用 Google 文档,并使用其 API。
我正在使用 http://fancybox.net/ 在模态窗口 iframe 中加载文档一个 jquery 插件
它工作正常,但是当在 Google 文档中按下保存并关闭按钮时,它会关闭 iframe 并将当前页面重定向到 Google 文档,那么有什么方法可以阻止重定向到 Google文档并关闭模式窗口?
谢谢。
最佳答案
我在 SO 上发现了一些其他涉及此类问题的问题;
How to prevent IFRAME from redirecting top-level window
How to prevent IFRAME from redirecting top-level window
基本上,它涉及使用“window.onbeforeunload”函数来终止 iframe(如果它尝试重定向)。
关于javascript - iframe 中的 Google 文档以及“保存并关闭”按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2664021/