August 29, 2013

How to change content of website loaded in iframe?

Ivan.daragan’s Question:

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

    <iframe src="></iframe>

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

Your script is running during runtime so it will not find the DOM of the iframe and will break. What you can do is create a function on your parent page like:

//On Your Parent page
function modifyIframeContent() {

Then call this function from the iframe after it loads.

// On Your Iframe page
window.onload = function() {

Of course: Your iframe must be of same domain for this work.

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+


Please fill the form - I will response as fast as I can!