Redirection in iframe pages

    A function recently made by the company uses iframe, and the parent page is embedded with sub-pages. There are quite a few pits in it. I actually encountered it last time, but I will describe it here today.

    Allow me to draw a sketch:

    

    The outer circle is the parent page, and the inner layer is the child page. We refer to the child page at the parent level. Since there are two pages, the URLs must be different. " Generally, the operations performed on the child pages are also Only works on subpages ", and now I'm talking about that!

    The function of the company needs to jump to the page after completing an operation on the sub-level page, so the code of the sub-level page is written as follows: submit => submit successfully => jump to page B. At this time, we found that the page jumped, but the child page jumped in the child page. What does it mean? In fact, the outer layer has not changed. When the child page is redirected, the jump is completed in the iframe. , F12, you will find that the href of the iframe has changed, but the URL of the browser address bar has not changed (the current browser address bar is naturally the parent page URL), and the effect we want is that the browser address bar changes (that is, the parent URL changes). So in the end, I made a page jump with the help of the middle page (home.aspx) to change the parent URL.

 

    

Guess you like

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