browser back acts on nested iframe before the page itself - is there a way to avoid it?

后端 未结 6 766
再見小時候
再見小時候 2020-12-13 12:54

I have a page with dynamic data loaded by some ajax and lots of javascript.

the page contains a list from which the user can choose and each selected value loads n

6条回答
  •  有刺的猬
    2020-12-13 14:00

    I manage cross domain iframe inside bootstrap modal, the only solution working for me is to put the following code inside the head of the each iframe pages:

        history.pushState(null, null, location.href);
        window.onpopstate = function () {
          history.go(1);
        };
    

    This will not work for everyone as you need to have the control of the iframe content, in addition it break the history chain of the parent window

提交回复
热议问题