XMLHttpRequest is deprecated. What to use instead?

前端 未结 3 1826
你的背包
你的背包 2021-02-08 18:19

Trying to use a pure JS approach to check if I have a valid JS image url. I am getting a warning that XMLHttpRequest is deprecated. What is a better way to do this?

3条回答
  •  没有蜡笔的小新
    2021-02-08 18:42

    The cause of the warning was that in http.open('HEAD', url, false); you put a third argument (async) as false. As per the https://xhr.spec.whatwg.org/#synchronous-flag it should be set to true.

提交回复
热议问题