Javascript Iframe innerHTML

后端 未结 10 2641
没有蜡笔的小新
没有蜡笔的小新 2020-11-27 07:08

Does anyone know how to get the HTML out of an IFRAME I have tried several different ways:

document.getElementById(\'iframe01\').contentDocument.body.innerHT         


        
10条回答
  •  醉酒成梦
    2020-11-27 07:47

    This solution works same as iFrame. I have created a PHP script that can get all the contents from the other website, and most important part is you can easily apply your custom jQuery to that external content. Please refer to the following script that can get all the contents from the other website and then you can apply your cusom jQuery/JS as well. This content can be used anywhere, inside any element or any page.

    /* Here I am writing a sample jQuery to hide the navigation menu You can write your own jQuery for this content */ //Hide Navigation bar jQuery(\".navbar\").hide(); "; //Append Custom JS with HTML $html = $content . $customJS; //Return customized HTML return $html; }

提交回复
热议问题