search

Home  >  Q&A  >  body text

javascript - Problems encountered in WeChat development

Recently I was developing the WeChat public platform, and I encountered some problems with WeChat’s built-in browser.
When I used WeChat’s built-in browser to open my website, I clicked on several pages in succession.
I I want to "close the current page" and "transfer the data of the current page back to the parent window", and at the same time "the parent window cannot be refreshed"

It is possible to do this under the browser, as follows:
"Close the current page":window.close();
"Transfer the data of the current page back to the parent window":window.opener...

But it is completely invalid under WeChat’s built-in browser. Is there a solution?
(How does WeChat’s built-in browser implement js to close the current page and bring the data back to the parent window?)

过去多啦不再A梦过去多啦不再A梦2766 days ago865

reply all(4)I'll reply

  • 巴扎黑

    巴扎黑2017-06-17 09:18:02

    WeChat cannot be implemented.

    A workaround is to do a single page application (SPA) instead of using parent-child windows.

    reply
    0
  • 迷茫

    迷茫2017-06-17 09:18:02

    opener should be a product of MS. WeChat uses Webkit, which has a different engine. Maybe webkit does not have opener.
    Recommended to use cookies.

    reply
    0
  • 黄舟

    黄舟2017-06-17 09:18:02

    First of all, your window.open is not compatible. Only IE can close it. WeChat browser is the core of Google. Another point is that if you want to close the WeChat window, quote WeChat’s js:

    <script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
    

    The calling method is:

    wx.closeWindow();
    

    This will close the current window, but the data cannot be brought back to the parent window.

    reply
    0
  • 某草草

    某草草2017-06-17 09:18:02

    Using jquery layer, I also encountered this problem during development and it was solved perfectly

    reply
    0
  • Cancelreply