2015-11-02 89 views
1

我有一個網絡資源,我打電話給一個對話框。CRM Dynamics 2015 IFrame通訊

看來,在CRM動態的最近更新,他們現在覆蓋window.frames對象,我用它來獲取所有iframe的列表之前。

這裏是幀的在控制檯中查看對象..

enter image description here

有誰知道我如何才能訪問頁面上可用I幀?

上的代碼,用於工作...

var found = false; 
$.each(parent.window.frames, function (i, val) { 
     if (!found) { 
      if (parent.window.frames[i].Xrm.Page.data != null) { 
       console.log("got here, page data not null"); 
       found = true; 
      } 
     } 
    }); 

版本動力學:7.0.2.53

+0

你確定你真的想這樣做嗎?它不受支持。什麼是最終目標? –

+0

目的是從原始iframe訪問表單上的數據。 – TWilly

回答

0

您可以嘗試使用下面的代碼來獲取所有的IFrame控件:

var iframeControlArray = Xrm.Page.getControl(function (control, index) { 
    return control.getControlType() == "iframe"; 
}); 

然後訪問IFrame DOM對象:

var iframeDomObject = iframeControlArray[0].getObject(); 
var iframeDocument = iframeDomObject.contentDocument 
     || iframeDomObject.contentWindow.document; 

如果在另一個域中的IFrame資源並且您有完全訪問權限,則最好使用window.postMessage()進行「跨域的IFrame通信」。 更多在這裏:

相關問題