xmlhttprequest

cross domain XMLHttprequest

♀尐吖头ヾ 提交于 2019-12-22 06:47:11
问题 Here is my situation: I have a Webserver machine, Client machine, and a third machine running some program that listens for XMLHttpRequests. Client accesses the Webserver from the Client machine, makes some changes, and then clicks on'Save'. At this point, data is being sent back to the Webserver and to the Third machine. All of this is being done using Javascript and XMLHttpRequest object. The post to the Webserver works fine, however post to the Third machine does not work, since it had a

correct usage of sinon's fake XMLHttpRequest

女生的网名这么多〃 提交于 2019-12-22 05:58:09
问题 I am creating XMLHttpRequest javascript module to get JSON data from server. Here is the code: (function() { var makeRequest = function(url,callback,opt) { var xhr; if (XMLHttpRequest) { // Mozilla, Safari, ... xhr = new XMLHttpRequest(); } else if (ActiveXObject) { // IE try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!xhr) { callback.call(this, 'Giving up :( Cannot create an XMLHTTP instance', null);

correct usage of sinon's fake XMLHttpRequest

∥☆過路亽.° 提交于 2019-12-22 05:58:01
问题 I am creating XMLHttpRequest javascript module to get JSON data from server. Here is the code: (function() { var makeRequest = function(url,callback,opt) { var xhr; if (XMLHttpRequest) { // Mozilla, Safari, ... xhr = new XMLHttpRequest(); } else if (ActiveXObject) { // IE try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!xhr) { callback.call(this, 'Giving up :( Cannot create an XMLHTTP instance', null);

How to easily listen for xhr requests with Javascript?

余生长醉 提交于 2019-12-22 05:33:28
问题 I am working on a Firefox extension and I want to know when a page initiates a xhr request, I saw a few codes but they were pretty big, is there any simple sample to achieve this? I am testing this code : function TracingListener() { //this.receivedData = []; } TracingListener.prototype = { originalListener: null, receivedData: null, // array for incoming data. onDataAvailable: function(request, context, inputStream, offset, count) { var binaryInputStream = CCIN("@mozilla.org

Wouldn't have been simpler to just discard cookies for cross-domain XHR?

試著忘記壹切 提交于 2019-12-22 05:16:12
问题 I keep fighting with strange limitations when developing for the web. One of them is the same-origin limitation for AJAX requests and I'm asking myself if instead of blocking requests to cross-domain resources wouldn't have been simpler to just discard cookies when making them (to avoid misuse of authentication credentials of the browser session). Cookies are a facility but quite not essential (for example you can generate pages with cookies in the request URLs if you need to keep context),

How should I securely store passwords and use http auth in a chrome extension

久未见 提交于 2019-12-22 05:04:54
问题 I'm making a chrome extension that requires fetching an xml file from a secure server. I'm currently using XMLHttpRequest() to make a call to the server https://username:password@mydomain.com which returns an xml object that I can parse and display. I want this extension to be available for more than just my hobby use, so it needs an options page to set and store the username and password. How should I store the user password in chrome so that it is secure? chrome has a localStorage global

What is the default timeout for AngularJS $http service requests?

泄露秘密 提交于 2019-12-22 03:40:38
问题 In $http docs it does not mention which is the default timeout in case of undefined. How can I know which is the default value for this configuration? 回答1: At one time the default timeout for http requests was 30 seconds, but now many browsers perform "keep-alive" polling by default so in all practicality there isn't one. I've had http requests sit for several minutes before the server itself finally gave up and issued a timeout. 来源: https://stackoverflow.com/questions/37547229/what-is-the

Memory-leak at a wrapped XMLHttpRequest function

匆匆过客 提交于 2019-12-22 00:59:00
问题 I wrote the following : function ao(){ this.count=0; this.flag=0; this.tmr=0; var self = this; this.make=function(){ //log("before: "+this.url+" "+this.xhr); self.xhr = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); //log("after: "+this.xhr); } this.request = function (method, url, sendStr, delay){ this.delay=delay; if(delay && self.tmr==0){ self.start(); } if(self.flag==0){ this.method = method; this.url = url; this.sendStr = sendStr; self.make();

understanding XMLHttpRequest responses using this (or other javascript) functions?

◇◆丶佛笑我妖孽 提交于 2019-12-21 23:12:16
问题 Is there anyway of getting iphone/iPad to access XMLHTTPRequests, i.e. ajax responses from a web page within UIWebView. I've tried a couple of solutions out there where the response url is changed so that the app can identify that it is indeed an ajax response. I'm new to ajax but I'm keen to learn. I just wandered if anyone could tell me the correlation between responses from ajax and the receiving browser. Getting it to work through the iOS's uiwebview would be an added bonus. So far I'm

Parsing XMLHttpRequest() result (using XPath)

坚强是说给别人听的谎言 提交于 2019-12-21 22:45:06
问题 I need in JavaScript to load in variable contents of another page from the same site and then get data from that contents (parse XML). I have gotten in text string variable the page's HTML using XMLHttpRequest() and responseText property. After that I converted text string into xml object (DOMParser) and tried to use XPath. In FireFox's console I saw error: Node cannot be used in a document other than the one in which it was created How can I convert XMLHttpRequest() result into document