简体   繁体   中英

How to remove any div in iframe

Hi Please tell me how can we remove any div in iframe for example my code is :

<!DOCTYPE html>
<html>
 <head>
 </head>
 <body>
   <iframe src="http://stayupdate.net" width="100%" height="800">
     <p>Your browser does not support iframes.</p>
   </iframe>
 </body>
</html>

I want to remove "creditline" div or its text

<div id="creditline">
  <span class=".alignleft">
  </span>Designed By 
  <a href="http://www.realwebmaker.in">Real Web Maker</a>
</div>

You can change only if you have access(file) to that page..Otherwise its not possible to change the content of other's page.And it should be.

Don't no about your requirement but..But you can do a trick.

Create a same size div,change the content according to you requirement. and by js or jquery put it exactly over iframe div.

Is not recommended at all,and its not reliable too.

I suppose you want to add script to your page, which removes a div tag inside the iframe. This is only possible if the page shown by the iframe ( http://stayupdate.net ) has a provision to do that. If you can modify the inner page, then you could add an event listener, which accepts an external command to remove a tag. The outer page can then send that command using postMessage, as described here . If the outer and inner pages are in the same domain, you can use a simple function call as described here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM