全球主机交流论坛

标题: 20元求一个html/js代码隐藏地址栏里的参数 [打印本页]

作者: shuni9    时间: 2020-10-7 17:23
标题: 20元求一个html/js代码隐藏地址栏里的参数
本帖最后由 shuni9 于 2020-10-7 17:24 编辑

我在一个页面有一个连接:

<a href="b.html?file=abc.pdf">点击</a>

点击去新的页面 ,在地址栏会显示   b.html?file=abc.pdf

我只有修改b.html的权限,我想在新的页面b.html把这个  file=abc.pdf 在地址栏隐藏掉不显示(这个参数是必须的,我只是不想显示出来)

QQ 176-462-1359
作者: Erik    时间: 2020-10-7 17:24
楼下大佬来.












                                                                           .






作者: tir    时间: 2020-10-7 17:24
不能,推荐用post传一个参数
作者: 逍遥自在    时间: 2020-10-7 17:25
这个好像不可以。不过你可以试试html框架??
作者: 大腿    时间: 2020-10-7 17:25
方法有好几种  1 加密 2post 3js 4 iframe
作者: reizhi    时间: 2020-10-7 17:26
这大概有N种实现方法,最简单的b.html里面嵌套iframe加载这个pdf
作者: dxt    时间: 2020-10-7 17:26
POST就可以,麻烦一点,无伤大雅
作者: naohion    时间: 2020-10-7 17:26
提示: 作者被禁止或删除 内容自动屏蔽
作者: byg    时间: 2020-10-7 17:38
提示: 作者被禁止或删除 内容自动屏蔽
作者: 风铃    时间: 2020-10-7 17:40
本帖最后由 风铃 于 2020-10-19 09:58 编辑

b.html里面加一段js


  1. window.history.replaceState(null, null, 'b.html');
复制代码


私聊支付宝转账

都快两个星期了,楼主失联了吗
作者: js攻城狮    时间: 2020-10-7 17:58
楼上说得对
作者: 冻猫    时间: 2020-10-7 18:12
意思是一开始要通过url传参数?那就把file=a.pdf存到localstorage里再无刷新转到b.html然后读参数再清理localstorage
  1. if (location.search){
  2.     window.localStorage.setItem('search', location.search.substr(1));
  3.     window.history.pushState(null, null, location.pathname);
  4. } else {
  5.   // 读取参数 file=a.pdf
  6.   var search = window.localStorage.getItem('search');
  7.   if (search) {
  8.     // 清理
  9.     window.localStorage.removeItem('search');
  10.   }
  11. }
复制代码

作者: yc260982    时间: 2020-10-7 18:27
后端收到参数后再跳转就是了
作者: malaohu    时间: 2020-10-7 19:17
  1. window.name
复制代码

可以了解一下,然后试一试!
作者: Lost_Scarecrow    时间: 2020-10-7 20:03
把参数拿到之后做个跳转就行了




欢迎光临 全球主机交流论坛 (https://hostloc-workers.ikyomon.com/) Powered by Discuz! X3.4