仅针对IE的JQuery对话框中的Iframe问题 [英] Issue with Iframe inside JQuery dialog only for IE

查看:71
本文介绍了仅针对IE的JQuery对话框中的Iframe问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的asp.net Web应用程序面临非常严重的问题,我在其中开发了一个页面,并在Jquery对话框中使用iframe加载该页面。因为当我尝试在IE中打开它时,我得到了与未定义对象相关的错误和许多后续错误,然后在我进行研究后发现对于IE我们需要在打开对话框之后根据此answer 我得到了解决方案现在我在IE中打开,当我试图关闭popup.final代码时,我会得到同样的错误。

I am facing very critical issue with my asp.net web application in which i have developed one page and loading that page using iframe inside Jquery dialog. in that i was getting errors related 'undefined object' and many subsequent errors when i am trying to open that in IE then after i did research and found that for IE we need to assign iframe src after open dialog as per this answer and i got solution at time of opening in IE now i am getting same errors when i am trying to close that popup.final code look like below.

<link href="../../App_Themes/Default/jquery-ui.css" rel="stylesheet" type="text/css" />  
    <script src="../../Scripts/jquery.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-ui.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.preload.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/js/ui/ui.core.js">

 <script language="javascript" type="text/javascript">
function openDialog() {

            var $dialog = jQuery('#dialog');
            $dialog.dialog({
                autoOpen: false,
                resizable: false,
                title: 'Register App',
                modal: true,
                height: 500,
                width: 950,
                show: 'puff',
                hide: 'puff',
                close: function (event, ui) {
                    $('#iframeManageApp').attr('src', 'about:blank');
                    $dialog.dialog('close');
                    $dialog.dialog('destroy');
                    if (isReload) {
                        if (isAdd)
                            $("#" + '<%=hdnIsApplicationAdd.ClientID %>').val("true");
                        else
                            $("#" + '<%=hdnIsApplicationAdd.ClientID %>').val("");

                        window.location.reload();
                    }

                },
                open: function (event, ui) {
                    $('#iframeManageApp').attr('src', 'RegisterApplication.aspx');
                }
            });

            $dialog.dialog('open');
        }
    </script>

对话框div如下所示

<div id="dialog" style="display: none; padding-left: 10px; overflow: hidden;">
        <iframe id="iframeManageApp" height="450px" width="910px" 
            frameborder="0" style="overflow: hidden;"></iframe>
    </div>

如果有人确实找到了此类问题的解决方案,请帮助我。对于这个问题,IE应该有什么问题?还建议我,如果有人有替代解决方案。

Please help me if anyone did found solution of this type of problem. What should be issue with IE regarding this problem? also suggest me if anyone have alternate solution for this.

在此先感谢。

更新:

经过一些研究后我发现这是问题,因为iframe页面内的js引用也是一样的。我刚刚更改了Test.aspx来代替RegisterApplication.aspx页面并且在IE中没有错误但是当我在其中添加了相同的js时,则存在相同的行为!

After some research i found that this is problem due to same js reference inside Iframe page as well. I have just changed Test.aspx in place of RegisterApplication.aspx page and there was no error in IE but when i have added same js inside that then there was same behavior!

<script src="../../Scripts/jquery.min.js" type="text/javascript"></script>


推荐答案

我已经通过对话框中的一些更改自行解决了这个问题选项,但无法找到发生这种情况的真正原因?

I have resolved this issue myself with some changes in dialog option but could not find the real cause why this was happening?

我已从对话框和对话框的最终代码中删除了hide ='puff'选项,如下所示

I have removed hide='puff' option from dialog and final code of dialog as per below

        $dialog.dialog({
            autoOpen: false,
            resizable: false,
            title: 'Test',
            modal: true,
            height: 500,
            width: 950,
            show: 'puff',
            close: function (event, ui) {
               -----
               -----

我想在关闭事件它将尝试找到jquery.min.js隐藏效果,它应该是我的问题的原因。但如果有人想要重现这个东西,那么你可以通过以下方式做到这一点

I think in close event it will try to find jquery.min.js for hide effect and it should be the cause of my problems. But if anyone want to reproduce this thing then you can do it by following ways

1)根据我的问题打开对话框代码(忽略重新加载部分事件)

2)创建另一个测试页面并在其中添加jquery.min.js的引用以及
3)在javascript的opendialog函数中的iframe内加载测试页面

1) open dialog code as per my question(ignore reload section in close event)
2) create another test page and add reference of jquery.min.js in that as well
3) load test page inside iframe in opendialog function of javascript

这篇关于仅针对IE的JQuery对话框中的Iframe问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆