{"id":1725,"date":"2022-08-30T15:18:55","date_gmt":"2022-08-30T15:18:55","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/29\/in-ie8-yepnope-not-loading-resource-within-iframe-at-1st-attempt-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:18:55","modified_gmt":"2022-08-30T15:18:55","slug":"in-ie8-yepnope-not-loading-resource-within-iframe-at-1st-attempt-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/in-ie8-yepnope-not-loading-resource-within-iframe-at-1st-attempt-collection-of-common-programming-errors\/","title":{"rendered":"In IE8, yepnope not loading resource within iframe at 1st attempt-Collection of common programming errors"},"content":{"rendered":"<p>I am using jquery modal dialogue, within dialogue we embedded iframe. iframe contain button &#8220;Show search result&#8221;<\/p>\n<p>at 1st attempt of &#8220;Show search result&#8221; button click, nothing happen. My result is not rendering in table (probably server request is not firing).<\/p>\n<p>It appears only when I switched to other tab of browesr, 2nd time onwards table rendering properly.<\/p>\n<pre><code>var __run = function(getData) {\n    yepnope({\n      test : $.fn.flexigrid,\n      nope : [ 'www\/css\/flexigrid.css', '\/www\/javascripts\/flexigrid.js'],\n      complete : getData\n    });\n<\/code><\/pre>\n<p>When __run fucntion called 1st time in IE8 then <strong>getData<\/strong> (passed function) should execute but not able to execute it.<\/p>\n<p><strong>This issue specific to IE8<\/strong><\/p>\n<p><strong>How to deal with above issue ? any quick suggestion ?<\/strong><\/p>\n<p>In other browser like firefox and chrome everything working fine.<\/p>\n<p>If I changed <strong>modal<\/strong> flag to <strong>false<\/strong> then 1st attempt of &#8220;Show search result&#8221; button click event, I am getting result in IE8, but we need modal dialogue so this is not good solution.<\/p>\n<pre><code>myWindow.dialog({\n                modal : false,\n<\/code><\/pre>\n<p><strong>Updated<\/strong> : <strong>Added Jquery UI dialogue code<\/strong><\/p>\n<pre><code>    NewModalUI.popWindow = function($){\n    var mWindow = null, mFrame;\n    var build = function(){\n        mWindow = $('').appendTo($('body'));\n        mFrame = mWindow.find('iframe')\n    };\n    var isReady = function(){\n        return mWindow;\n    };\n    var isVisible = function(){\n        return (!mWindow.is(':hidden'))\n    };\n    var close = function(){\n        __log(\"Window closed ...\");\n        mFrame.attr('src', '');\n        mWindow.dialog('close')\n    };\n    var open = function(url){\n        if(!isReady()){\n            build()\n            mFrame.bind('load.modalWindow',function(){\n                var $div = mFrame.contents().find('.submitContainerDiv');\n                if($div.find('.submitBtns').find('input').length == 1){\n                    $div.hide()\n                }\n            })\n            mFrame.attr('src', url)\n            mWindow.dialog({\n                modal : true,\n                height: $(window).height()-100,\n                minHeight: '250',\n                maxHeight: '90%',\n                width:'80%',\n                minWidth : '50%',\n                maxWidth:'90%',\n                buttons : { \n                    'Cancel':function(){\n                        $(this).dialog('close')\n                    }\n                },\n                beforeClose : function(){\n                    mFrame.attr('src', '')\n                }\n            })\n        }\n\n        if(!isVisible()){\n            mFrame.attr('src', url)\n            mWindow.dialog('open')\n        }else{\n            mFrame.attr('src', url)\n        }\n    };\n    return {\n        window: mWindow,\n        build : build,\n        isReady : isReady,\n        isVisible : isVisible,\n        close : close,\n        open : open\n    }\n}(jQuery);\n<\/code><\/pre>\n<p>Also observed IE8 generated html code<\/p>\n<p>Either IE8 or yepnope adding onload event attribute with null value to script tag Ex.<\/p>\n<pre><code>\n<\/code><\/pre>\n<p>2nd time onwards onload event attribute value changing for resources loaded by yepnope &amp; search result populated in grid. Ex.<\/p>\n<pre><code> \n<\/code><\/pre>\n<p>Hope for the best solution<\/p>\n<p>Thanks in advance.<\/p>\n<ol>\n<li>\n<p>I made an example that should be self-explanatory at http:\/\/jsfiddle.net\/uUpfg\/ I used jQuery 1.9.1 and jQuery UI 1.9.2<\/p>\n<p><strong>HTML<\/strong><\/p>\n<pre><code>Show dialog\nI am the dialog ;)\n<\/code><\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre><code>;(function ( $, window, document, undefined ) {\n\n    $('#show-dlg').on('click', function() {\n\n        var id = $(this).attr('href');\n\n        $(id).dialog({\n            bgiframe: true,\n            resizable: false,\n            draggable: false,\n            modal: true\n        });\n\n        return false;\n    });\n\n\n})( jQuery, window, document );\n<\/code><\/pre>\n<p><strong>CSS<\/strong><\/p>\n<pre><code>.hide {\n    display: none;\n}\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-29 06:18:03. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I am using jquery modal dialogue, within dialogue we embedded iframe. iframe contain button &#8220;Show search result&#8221; at 1st attempt of &#8220;Show search result&#8221; button click, nothing happen. My result is not rendering in table (probably server request is not firing). It appears only when I switched to other tab of browesr, 2nd time onwards [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1725","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1725","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1725"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1725\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}