javascript - Problems encountered in WeChat development
过去多啦不再A梦
过去多啦不再A梦 2017-06-17 09:16:02
0
4
816

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梦

reply all(4)
巴扎黑

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:

<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.

某草草

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!