百变鹏仔-专注前端行业精选
网页禁止返回 H5禁止物理返回 vue禁止返回
作者:鹏仔先生日期:2021-02-19 14:55:39浏览:2398分类:JavaScript
项目中,H5公众号授权我是让进入首页判断是否授权,没授权跳转授权进行授权完成在进入首页,安卓端授权完成,用户物理返回正常,没问题,IOS授权完之后返回结果不走接口了...
所以想到的办法就是手机禁止物理返回,那么安排下
原生方法
history.pushState(null, null, document.URL); window.addEventListener('popstate', function () { history.pushState(null, null, document.URL); });
在vue中,我们只需要写在mounted里即可
mounted() { history.pushState(null, null, document.URL); window.addEventListener('popstate', function () { history.pushState(null, null, document.URL); }); },
手机扫码访问
猜你还喜欢
- 04-19 VUE实现点击复制
- 04-16 vue将页面生成图片 vue生成海报
- 04-16 vue路由切换滑动效果 vue页面跳转交互 vue实现动画跳转
- 04-07 vue跳转页面清除历史记录,页面跳转删除历史记录
- 02-22 VUE You are using the runtime-only build of Vue where the template compiler is not available. Either
- 01-19 elementui多选上传 before-upload 格式效验错误总会触发before-remove (elementui多选上传on-success只执行了一次,只上传成功了一条)
- 10-08 vue按钮限制连点封装 自定义指令限制连点
- 08-19 使用HBuilderX将vue或H5项目打包app
- 07-15 小程序嵌入网页向小程序跳转并传参,微信小程序中实现公众号授权获取openId
- 07-13 vue中实现文件批量打包压缩下载(以及下载跨域问题分析)
- 07-08 uniapp调用地图,进行位置查询,标记定位
- 11-05 js截取字符串前几位或者截取字符串后几位
取消回复欢迎 你 发表评论:
- 搜索
-
- 最新文章
- 随机文章
- 随机tag
暂无评论,来添加一个吧。