Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
318 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...