iframe inside angular2 component, Property 'contentWindow' does not exist on type 'HTMLElement'

前端 未结 7 2064
一整个雨季
一整个雨季 2020-12-03 07:44

I have an iframe inside a angular2 component, and I am trying to change the content of the iframe by accessing the contentWindow.
The iframe should contain a simple butt

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-03 08:21

    I solved the problem in the following way:

     var ID = document.getElementById("Iframe");
     var Iframe = eval("(ID.contentWindow || ID.contentDocument)");
     Iframe.CallIframeFunction();
    

提交回复
热议问题