V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
icemanpro
V2EX  ›  Vue.js

打开其它网站时,如何修改请求头?

  •  
  •   icemanpro · 2021-04-02 10:10:41 +08:00 · 2564 次点击
    这是一个创建于 1091 天前的主题,其中的信息可能已经有所发展或是发生改变。
    要跳转到其它网站上,但要将 token 加到请求头内,有没有什么办法?
    12 条回复    2021-04-02 22:16:44 +08:00
    no1xsyzy
        1
    no1xsyzy  
       2021-04-02 10:16:50 +08:00
    跳转不能加任意头,只有 AJAX 请求可以加任意头。
    killergun
        2
    killergun  
       2021-04-02 10:19:40 +08:00
    跳转应该只能加在 url 上
    wunonglin
        3
    wunonglin  
       2021-04-02 10:25:12 +08:00
    啥意思?

    请求第三方 API ?如果是这样的话直接带上就好了啊(要 CORS )。

    url 跳转只能用 GET 请求参数带上
    uselessVisitor
        4
    uselessVisitor  
       2021-04-02 10:25:43 +08:00
    跳转不能
    Balloonwj
        5
    Balloonwj  
       2021-04-02 10:35:03 +08:00
    下一个浏览器插件就可以了,例如 SmartHeader 。
    leven87
        6
    leven87  
       2021-04-02 11:17:27 +08:00
    For the description, I don't know. But request always could be based on http protocol, you could add token in the header part.
    shellus
        7
    shellus  
       2021-04-02 11:18:46 +08:00
    chrome 扩展:ModHeader
    opengps
        8
    opengps  
       2021-04-02 11:20:21 +08:00
    使用 js 函数控制跳转,避免 a 标签直接跳转
    sxbxjhwm
        9
    sxbxjhwm  
       2021-04-02 13:12:13 +08:00
    自己搭一个反向代理
    Alchemist13
        10
    Alchemist13  
       2021-04-02 15:25:05 +08:00
    @leven87 兄弟,为什么要在中文社区说英语,你会中文的吧 233
    Te11UA
        11
    Te11UA  
       2021-04-02 15:48:39 +08:00
    modheader 之类的 chrome 插件就能干
    leven87
        12
    leven87  
       2021-04-02 22:16:44 +08:00
    @Alchemist13 I just practice my English skill and don't want to forget. As well people here can understand.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3080 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 12:44 · PVG 20:44 · LAX 05:44 · JFK 08:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.