1// read text from URL location
2function getText(){
3 var request = new XMLHttpRequest();
4 request.open('GET', 'http://www.xxxxx.com/pocket.txt', true);
5 request.send(null);
6 request.onreadystatechange = function () {
7 if (request.readyState === 4 && request.status === 200) {
8 var type = request.getResponseHeader('Content-Type');
9 if (type.indexOf("text") !== 1) {
10 return request.responseText;
11 }
12 }
13 }
14}