fetchは代替にはならない。timeoutやprogressは無い。
https://teratail.com/questions/40200
Last active
June 22, 2018 06:07
-
-
Save 7cc/7c8edad9aad59c1df50fcdd0826695d3 to your computer and use it in GitHub Desktop.
xhr or fetch for document
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var url = "" | |
| fetch(url).then(function(res){ | |
| res.text().then(function(mytext){ | |
| var doc = document.implementation.createHTMLDocument("") | |
| doc.body.insertAdjacentHTML = mytext | |
| console.log(doc) | |
| }) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function get(url) { | |
| var xhr = new XMLHttpRequest() | |
| xhr.open("get", url) | |
| xhr.onload = function(res) { | |
| console.log(xhr) | |
| } | |
| //xhr.responseType = "document" | |
| xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded;charset=UTF-8"); | |
| xhr.withCredentials = true | |
| xhr.send(null) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment