2

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>

And dialog div as per below

<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>

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.

Thanks in Advance.

Update:

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>
Community
  • 1
  • 1
Arun Rana
  • 8,426
  • 14
  • 67
  • 107
  • [Does this describe the issue you're facing?](http://msdn.microsoft.com/en-us/library/gg622929%28v=VS.85%29.aspx?ppud=4) – Ohgodwhy Jun 29 '12 at 14:20
  • @Ohgodwhy Yes please let me know if i described anything wrong way – Arun Rana Jun 30 '12 at 04:13
  • 1
    well. My thoughts are that you're destroying the dialog, which removes it from the DOM completed in IE9, no cachable references. In other browsers, it's stored so you can still access variables from it. The way your code looks..I don't know, i'm not sure what's up with `isReload` and `isAdd`, and whether or not they're referencing something from the iFrame. If that's the case, this code will not work in IE simply because of this. Your best bet is to place the `$dialog` code before `window.location.reload();` – Ohgodwhy Jun 30 '12 at 04:19
  • isReload and isAdd is not related Iframe, it's jus logic refresh parent page after closing popup. and I have also tried with commenting that and errors remain same in IE. I have also tried with removing destroy statement and in that case it will go in loop to closing popup again & again in all browser and in IE errors also there. – Arun Rana Jun 30 '12 at 04:47
  • Do you know how to use breakpoints in web inspectors so you can see which line the code breaks on? From there, we can better assess what is being passed as undefined. I prefer Firefox with Firebug because I'm biased, [Here's a great tutorial that will get you started with debugging](http://getfirebug.com/doc/breakpoints/demo.html) – Ohgodwhy Jun 30 '12 at 04:52
  • When i have replace page to blank page in iframe it's worked well so my problem is due to reagisterapplication.aspx (inside iframe) which also contain javascripts inside that. – Arun Rana Jun 30 '12 at 06:31
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/13244/discussion-between-arun-rana-and-ohgodwhy) – Arun Rana Jun 30 '12 at 06:47
  • @Ohgodwhy He says the problem is with ie, so firefox debugging and firebug is not going to help at all. – Ally Oct 17 '12 at 12:32
  • @Ally this question is over 4 months old. Initially, it had nothing about IE specifically written in the title or the question body. Have a nice day. – Ohgodwhy Oct 17 '12 at 16:44

1 Answers1

3

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

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) {
               -----
               -----

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) 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

Arun Rana
  • 8,426
  • 14
  • 67
  • 107