zoukankan      html  css  js  c++  java
  • 关于微信分享链接的识别

    公众号开发中,有时会遇到我们的页面被用户分享给好友,然后分享到的用户在录入信息时,某些情况下回事分享人的openID被写入(比如从session中取用户信息)

    这里要记录的是分享的页面的识别,分享的页面在url 的参数中都有一个from=singlemessage

    所以如果需要对分享的链接做处理(比如限制、重新获取openID等),就可以根据这个来做了

     1 //判断下单入口是否由他人分享的链接进入
     2             $(function isShare() {
     3                 var isShare = getUrlParam("from");
     4                 if (typeof(isShare) != 'undefined' && isShare != null && isShare == 'singlemessage') {
     5                     mui.alert('目前暂不支持扫码之外的下单方式!','');
     6                     document.getElementById("submit").disabled=true;
     7                 }
     8             });
     9 
    10 // 获取url中的参数
    11             function getUrlParam (name) {
    12                  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    13                  var r = window.location.search.substr(1).match(reg);
    14                  if (r!= null) {
    15                     return unescape(r[2]);
    16                  }else{
    17                     return null;
    18                  }
    19             }
  • 相关阅读:
    Live2d Test Env
    Live2d Test Env
    Live2d Test Env
    Live2d Test Env
    Live2d Test Env
    Live2d Test Env
    Live2d Test Env
    Live2d Test Env
    python嵌套列表知多少
    旋转图像
  • 原文地址:https://www.cnblogs.com/binTke170120/p/7562710.html
Copyright © 2011-2022 走看看