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?)
WeChat cannot be implemented.
A workaround is to do a single page application (SPA) instead of using parent-child windows.
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.
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:
The calling method is:
This will close the current window, but the data cannot be brought back to the parent window.
Using jquery layer, I also encountered this problem during development and it was solved perfectly