How does the html tag a jump out of the iframe

I encountered this problem when coding tonight: the webpage in the iframe has an a tag, and the a tag is a link to the target webpage that is not in the iframe, and then found that after executing it once, it did not jump out of the iframe but could reach the target webpage.


Solution:
Let the a tag execute the following code:

window.top.location='目标网页';

You can execute a method in js by defining the onClick event of a, and the method is the above code.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326074915&siteId=291194637