-1

I have an iFrame and there is a anchor tag inside it with target="_blank". (<a href='#' target='_blank'>Link</a>)

What I want is when the page loads, the <a> tag is clicked automatically. I have tried several ways to achieve this with no luck yet.

One more thing, I can only change the code inside of the iFrame. The code of the iFrame is not in my hand.

Wolfack
  • 2,667
  • 1
  • 26
  • 50
  • Because of security issues, you can't access the inside of an iframe, unless it's same origin. Imagine you had a full screen iframe of a login page. It would hardly be fair if the owner of the webpage could go in and pull put your password as you type it in. – Oliver Oct 08 '15 at 06:47

1 Answers1

0

Because of Same Origin Policy [https://en.wikipedia.org/wiki/Same-origin_policy] browsers won't allow you do this UNLESS the iFrame and the parent page are on the same domain. You may have to try an alternative solution that doesn't involve an iFrame. A good reference to this issue is: https://stackoverflow.com/a/3076648/3188771

Community
  • 1
  • 1