PDA

View Full Version : [CLOSED] [#496] DocumentReady in iframe of two different domain does not work in Firefox 29.x.x



RCN
May 28, 2014, 3:13 PM
DocumentReady event is not raised when a IFrame is being called in by a page in another domain. The problem occurs on FireFox, version 29.


Domain 1 [example1.com/Home/Index]:



<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Index</title>
<script type="text/javascript">
var onReady = function global_onReady() {
var iframe = document.createElement("iframe");
iframe.id = "iframe1";
iframe.name = "iframe1";
iframe.style.display = "none";

document.body.appendChild(iframe);

var form = document.createElement("form");
form.name = "form1";
form.action = "http://localhost:11415/Home/Index";
form.target = iframe.name;
form.method = "post";
form.style.display = "none";

var fields = { fld1: "1", fld2: "2", fld3: "3" };

for (var fld in fields) {
var input = document.createElement("input");
input.name = fld;
input.value = fields[fld];

form.appendChild(input);
}

document.body.appendChild(form);

form.submit();
};
</script>
>
</head>
<body>
<ext:ResourceManager CleanRequestUrl="false" runat="server">
<Listeners>
<DocumentReady Handler="onReady();" />
</Listeners>
</ext:ResourceManager>
</body>
</html>



Domain 2 [localhost:11415/Home/Index]:



<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Index</title>
</head>
<body>
<ext:ResourceManager CleanRequestUrl="true" runat="server">
<Listeners>
<DocumentReady Handler="alert('This alert dont occurs in Firefox 29!');" />
</Listeners>
</ext:ResourceManager>
</body>
</html>

Daniil
May 28, 2014, 4:13 PM
Hi Raphael,

Do you mean that it is OK in other browsers except FireFox?

Could you ensure that an iframe is loaded correctly? Maybe, it cannot load Ext.NET resources, for example.

RCN
May 28, 2014, 5:09 PM
Do you mean that it is OK in other browsers except FireFox?

Yes, on IE and on Chrome it works as expected.



Could you ensure that an iframe is loaded correctly? Maybe, it cannot load Ext.NET resources, for example.
Yes, the i frame was loaded correctly.

Daniil
May 29, 2014, 5:47 AM
Ok, I've reproduced that. A JavaScript error occurs in FireFox.

view.getComputedStyle(...) is null

Evan suggest a workaround here.
http://www.sencha.com/forum/showthread.php?276869&p=1015588&viewfull=1#post1015588

Created an Issue to track this defect.
https://github.com/extnet/Ext.NET/issues/496

RCN
Jan 29, 2015, 5:37 PM
Any update?

Daniil
Jan 30, 2015, 6:52 AM
Please try this (just add into a page's <head>).

Ext.Array.each(Ext.feature.tests, function(test) {
if (test.name === "RightMargin") {
test.fn = function(doc, div) {
var view = doc.defaultView;

if (Ext.isGecko) {
return true;
} else {
return !(view && view.getComputedStyle(div.firstChild.firstChild, null).marginRight != '0px');
}

return true;

}
}

if (test.name === "TransparentColor") {
test.fn = function(doc, div) {
var view = doc.defaultView;

if (Ext.isGecko) {
return true;
} else {
return !(view && view.getComputedStyle(div.lastChild, null).backgroundColor != 'transparent');
}

return true;
}
}
});

RCN
Jan 30, 2015, 11:46 AM
Thank you daniil

Daniil
Jan 30, 2015, 1:20 PM
Decided to apply the fix in the revision 6293 (trunk). It goes to 3.1.0 beta.

RCN
Jan 30, 2015, 1:25 PM
Decided to apply the fix in the revision 6293 (trunk). It goes to 3.1.0 beta.


Thank you Daniil