Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

单页应用中在微信页面中设置标题 #2

Open
Liqihan opened this issue Apr 27, 2017 · 0 comments
Open

单页应用中在微信页面中设置标题 #2

Liqihan opened this issue Apr 27, 2017 · 0 comments
Labels

Comments

@Liqihan
Copy link
Owner

Liqihan commented Apr 27, 2017

单页应用在微信中设置标题

正常来说,一个h5页面分享到微信中,或者用微信扫一扫打开的页面,微信会默认赌气head标签中的title,来设置成当前页面的标题。

但是当我们使用vue或者react来构建单页面应用的时候,比如文章详情页面中,底部有相关阅读的跳转,点击之后并不会设置当前页面的标题。所以会导致体验不是特别好。后来试了一下,用iframe完美的解决了这个问题,

详情代码请看

单页应用在微信中设置标题

补充:

为什么可以通过iframe来设置微信中页面的标题呢?
以为iframe中加载的是文档,加载完成会触发ios监听中的onpageshow方法,所以同理可以在其他app内,但前提是ios提供了监听方法

@Liqihan Liqihan added the blog label Apr 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant