vontio
V2EX  ›  问与答

js能否做https请求

  •  
  •   vontio · Dec 25, 2013 · 4905 views
    This topic created in 4699 days ago, the information mentioned may be changed or developed.
    8 replies  •  1970-01-01 08:00:00 +08:00
    lichao
    lichao
    Dec 25, 2013
    1
    是说 Ajax 吗?
    受限于 [同源策略] ,网页本身如果是 HTTPS 协议,Ajax 就可执行 HTTPS 请求。
    JSONP 则不受限制
    vontio
    vontio
    OP
    Dec 25, 2013
    2
    @lichao 有办法绕过吗同源吗,js是本地的,请求的地址是https的. 用前端js做爬虫,有没有可能
    muzuiget
    muzuiget
    Dec 25, 2013
    4
    典型的 X-Y 问题,用 js 做爬虫,直接上 node.js 就是了,费那个劲绕过同源策略干嘛?
    keefo
    keefo
    Dec 25, 2013
    5
    能
    lichao
    lichao
    Dec 25, 2013
    6
    @vontio 这是浏览器的安全机制,不好绕过吧。
    正如 @muzuiget 说的,爬虫还是交给服务端吧
    fengliu222
    fengliu222
    Dec 25, 2013
    8
    服务器端代理是比较方便的做法。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2198 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 11:27 · PVG 19:27 · LAX 03:27 · JFK 06:27
    ♥ Do have faith in what you're doing.