Search code examples
javascriptjqueryhtmliframewhitelist

How to change content of website loaded in iframe?


I need to change content of website using jQuery loaded in iframe from other domain such this:

<html>
  <head>
  </head>
  <body>
    <iframe src="site.com/somepage.html></iframe>
    <script>
      $('iframe').find('div#message').value('hello');
    </script>
  </body>
</html>

Also I added target link to whitelist. Could any helps? Thanks.


Solution

  • If you want to get a website of different domain you have to use parser in your server side which will parse the html from the website and then echo the parsed html to your client side