xmlhttprequest

Get HTML document as string before it has loaded

怎甘沉沦 提交于 2019-12-24 10:57:21
问题 I looked at this and this answer to that question, but they only get the HTML contents of the page up until the <script> that executes the code. For example, in this snippet: <!DOCTYPE html> <html> <head> <title>Test</title> <script type="text/javascript"> console.log(new XMLSerializer().serializeToString(document)); </script> <link type="text/css" rel="stylesheet" href="style.css"> </head> <body> <script type="text/javascript" src="testscript1.js"></script> <script type="text/javascript" src

Firefox 3 CORS XMLHTTPRequest doesn't seem to work

Deadly 提交于 2019-12-24 10:40:50
问题 I implemented a REST service, which I'm calling from a javascript application on a different domain. I'm attempting to do a GET request, and setting the Authorization: header, with a custom authentication scheme. Because I'm setting a custom header, Firefox will start with a preflight OPTIONS request. This request looks like this (simplified): OPTIONS /v1/articles HTTP/1.1 Host: example.org User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10

Http request in forEach function. Angular2

眉间皱痕 提交于 2019-12-24 10:19:43
问题 Having problem with using forEach function with http requests. I have a _watchlistElements variable, which holds following data: [{"xid":"DP_049908","name":"t10"},{"xid":"DP_928829","name":"t13"},{"xid":"DP_588690","name":"t14"},{"xid":"DP_891890","name":"t16"},{"xid":"DP_693259","name":"t17"}] Now, Im making a function which will download data from server for each of these xid elements: private download() { this._watchlistElements.forEach(v => this.http.get('http://localhost:8080/getValue/'

AJAX request only works once in IE

孤街醉人 提交于 2019-12-24 10:13:12
问题 I have this issue, in FF it works great but in IE only works once... the html is <form> <input type="button" value="test" onclick="javascript:vote();"/> </form> the javascript <script type="text/javascript"> function vote(){ if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET","../php/votes.php",true); xmlhttp.send(null); } </script> and the

How can I clear HTTP headers for AJAX GET calls?

隐身守侯 提交于 2019-12-24 09:19:30
问题 I have developed a solution that relies on an AJAX call to retrieve information and update the client page every 10 seconds. This is working fine, but I am concerned at the scalability of the code, given the number and length of headers being passed from client to server and back again. I have removed a number of redundant headers on the server side, mostly ASP.NET-related, and now I'm attempting to cut down on the headers coming from the client. The browser used by my company is IE (version

Pre-flight Request not triggered for CORS check

江枫思渺然 提交于 2019-12-24 08:19:02
问题 As I understand, a pre-flight request is sent by the browser if any of the following conditions is false (source: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Simple_requests): Request method is GET, HEAD or POST. Custom headers are not set. Content-Type header value is either application/x-www-form-urlencoded , multipart/form-data or text/plain . I have a web app which sends a GET request to a server on a different origin. Since I have to send cookies to the server, the property

Multiple Access-Control-Allow-Origin headers

给你一囗甜甜゛ 提交于 2019-12-24 07:43:45
问题 For reference I'm using Visual Studio 2017 and Windows 10. I have a web api and corresponding web application with user accounts. When I attempted to login I was met with an error which said No Access-Control-Allow-Origin header is present. I found a guide that walked me through how to setup CORS. This is the guide I used. https://social.technet.microsoft.com/wiki/contents/articles/33771.fix-to-no-access-control-allow-origin-header-is-present-or-working-with-cross-origin-request-in-asp-net

Multiple Access-Control-Allow-Origin headers

天涯浪子 提交于 2019-12-24 07:42:09
问题 For reference I'm using Visual Studio 2017 and Windows 10. I have a web api and corresponding web application with user accounts. When I attempted to login I was met with an error which said No Access-Control-Allow-Origin header is present. I found a guide that walked me through how to setup CORS. This is the guide I used. https://social.technet.microsoft.com/wiki/contents/articles/33771.fix-to-no-access-control-allow-origin-header-is-present-or-working-with-cross-origin-request-in-asp-net

How do the different browsers handle timeout with synchronous XHR

拈花ヽ惹草 提交于 2019-12-24 07:35:16
问题 On Wednesday the AJAXy CRM system I maintain broke for many users, because Firefox started reporting "Use of XMLHttpRequest's timeout attribute is not supported in the synchronous mode in window context" . The other major browsers still work fine so as a workaround I have advised people not to use Firefox. From what I understand synchronous requests are A Bad Thing, so I can only assume some recent update to Firefox has stopped it from accommodating Bad Things. All previous discussions (here

Why my requests with http basic auth get status 0 when I set bad credentials ? Phonegap Android

随声附和 提交于 2019-12-24 07:19:23
问题 In my android app made with phonegap, users can sign in. When they do it, JQuery get their login and their password and do an ajax call with theirs credentials following the HTTP Basic Auth specification. Everything works fine. However I'm encountering a problem for handling the situation when a user sets bad credentials. In the .error() callback, I want to display a specific message for status 401 (like "authentication failed") and another message for other status ("technical problem"). My