中文路径传参乱码终极解决方案(适用所有浏览器)


对!你没有看错,就是这么浓缩的一段精华代码!

加密

function GetQueryString(name) {
         var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
         var r = encodeURI(window.location.search).substr(1).match(reg);
         if (r != null) return r[2];
     return null;
}

解密


   sources = JSON.parse(decodeURIComponent(decodeURIComponent(sources)));
   $.each(sources, function(index, value) {
     if (value['type'] === 'video/mp4' && value['res'] === 'ORIGIN') {
          ckSources = value['src'];
     }

你可能感兴趣的:(极简方案)