XMLHttpRequest to read an external file
问题 I want to retrieve the data contained in a text file (from a given URL) through JavaScript (running on the client's browser). So far, I've tried the following approach: var xmlhttp, text; xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET', 'http://www.example.com/file.txt', false); xmlhttp.send(); text = xmlhttp.responseText; But it only works for Firefox. Does anyone have any suggestions to make this work in every browser? Thanks 回答1: IT works using xmlhttp=new ActiveXObject("Microsoft