Reload parent window from child window

前端 未结 12 1346
-上瘾入骨i
-上瘾入骨i 2020-11-28 09:35

How can I reload my child window\'s parent using jQuery?

相关标签:
12条回答
  • 2020-11-28 10:01
    parent.location.reload();
    

    This should work.

    0 讨论(0)
  • 2020-11-28 10:01

    if you want to simply reload the parent window of child window: This line code below is enough for that.

    opener.location.reload(); 
    

    if you want to reload parent window with query string (request) with old or new values. Following code will do the work.

    if (opener.location.href.indexOf('?') > 0) {
          var baseUrl = opener.location.href.substring(0, opener.location.href.indexOf('?'));
          opener.location.href = baseUrl + "?param1=abc&param2=123";
    }
    else {
          opener.location.href = opener.location.href + "?param1=abc&param2=123";
    }
    

    this opener.location.reload(); is not required in above example.

    0 讨论(0)
  • 2020-11-28 10:06

    For Atlassian Connect Apps, use AP.navigator.reload();

    See details here

    0 讨论(0)
  • 2020-11-28 10:09
    window.parent.opener.location.reload();
    

    worked for me.

    0 讨论(0)
  • 2020-11-28 10:13

    You can reload parent window location using :

    window.opener.location.href = window.opener.location.href;
    
    0 讨论(0)
  • 2020-11-28 10:15

    You can use window.opener, window.parent, or window.top to reference the window in question. From there, you just call the reload method (e.g.: window.parent.location.reload()).

    However, as a caveat, you might have problems with window.opener if you need to navigate away from the originally opened page since the reference will be lost.

    0 讨论(0)
提交回复
热议问题