xhr

Progressive enhancement of anchor tags to avoid onclick="return false;"

Unobtrusive JS suggests that we don't have any onclick attributes in our HTML templates. <a href="/controller/foo/1">View Foo 1</a> A basic progressive enhancement is to convert that anchor tag to use XHR to retrieve a DOM fragment. So, I write JS to add an event listener for a."click" then make an XHR to a.href. Alas, the browser...

Removing DOM event handlers in long-running browser session

I have a browser interface with a ul#contacts list on the left and div#contact property panel (email, phone) on the right. Click a contact in the list and my app makes an XHR request to get the contact property HTML fragment and update div#contact.innerHTML. Each contact fragment has an "Edit Contact" link. With JS, I progressively upg...

Detecting if a browser's cache is full

We've identified that full browser caches are the cause of a problem on our extranet. It only affects a small number of our users, but we'd like to alert them to the problem and give them some guidance on how to fix the problem for themselves. We'd like to use a similar system to the one which GMail uses. When it detects that your brows...

Is it possible to distinguish network errors from cross-origin errors?

http://www.w3.org/TR/access-control/ Reading the CORS spec linked above, it seems to be the case that it's impossible to reliably distinguish between a generic "network error" and a cross-origin access denied error. From the spec: If there is a network error Apply the network error steps. Perform a resource sharing check. If it...

Cross site scripting help?

I have a piece of javascript executing on a jetty server which is sending a XMLHTTPRequest to a scoket on another server(wamp server). The request gets sent to the socket, however the XHR response seems to be getting blocked. My only thoughts on this is it may be an issue with XSS(cross site scripting). Is there a way in which i could en...

How to use JSONP to overcome XSS issue?

I have a piece of javascript executing on a jetty server which is sending a XMLHTTPRequest to a scoket on another server(wamp server). The request gets sent to the socket, however the XHR response seems to be getting blocked. I have heard that I can use JSONP to overcome this problem. However as I am new to both javascript and I have ne...

bing search api ajax does not work

Hi guys, I want to use the Bing's search api with javascript. Actually, I want the user to write something and query Bing in order to get just images. so, I tried it using ajax. If I try the url http://api.search.live.net/xml.aspx?Appid=[YOURAPIKEY]&amp;sources=image&amp;query=home directly (with the browser) I do get an xml document. ...

jQuery error when aborting an ajax call only in Internet Explorer

When mousing over an image in a jcarousel, my site displays a popup whose contents are loaded via ajax. I'm doing what I thought was fairly straightforward; keeping a handle to the xhrRequest object, and aborting the existing one before making a new request. It works great in all browsers except IE, where I receive an error "Object doe...

Modifying jQuery ajax request Connection header

I'm trying to modify the Connection header with the following code with no success jQuery.ajax({ url: URL, async: boolVariable, beforeSend: function(xhr) { xhr.setRequestHeader("Connection", "close"); } }) The request headers via Firebug show: Connection keep-alive X-Requested-With XMLHttpRequest...

RequestBuilder timeouts and browser connection limits per domain.

This is specifically about GWT's RequestBuilder, but should apply to general XHR as well. My company is having me build a near realtime chat application over HTTP. Yes, I do realize there are better ways to do chat aplications, but this is what they want. Eventually we want it working on the iPad/iPhone as well so flash is out, which rul...

Loading javascript on demand problem

I have a problem with dojo.xhrGet (dojo 1.3) in IE8 where: 1. I have a set javascript files that must satisfy some dependecies proj4js.js depends on OLprototype.js while lcc.js and EPSG3308.js are needed if proj4js.js is used. 2. if I execute the script below, funLoad("/proj4js/lib/proj4js.js") fails on IE8, while it works on FF3.6.3; f...

XMLhttpRequest > PHP > XMLhttpRequest

Hi guys, I have another question. XMLhttpRequests haunt me. Everything is now in the database but I need this data to update my page on firt page load or reload. The XHR is triggered in JavaScript file which triggers PHP-Script. PHP-Script access MySQL database. But how do I get the fetched records back into my JavaScript for page updat...

xmlhttprequest request uri too large

Hi, Well I hoped everything would work fine finally. But of course it doesn't. The new problem is the following message: Request-URI Too Large The requested URL's length exceeds the capacity limit for this server. My fear is that I have to find another method of transmitting the data or is a solution possible? Code of XHR function: ...

XHR FF POST size limit

Hi, My XHR POST REQUEST is cut off. When I try to reload my page information is missing. Firebugs sends following message: ... Firebug request size limit has been reached by Firebug. ... My question is: What are my options? Would it work if I declare the content.length in the header? I added a line to my apache config file and res...

Execute JavaScript within responseHTML

When using responseHTML with XHR, Firefox executes the javascripts within the loaded responseHTML, chromium does not. if i add a script that will parse and execute the scripts, it will work on chromium but they result being executed twice in Firefox. Any idea how to know if browser will execute loaded scripts or not other than through ag...

Trigger jQuery's ajaxStop event when aborted calls exist

I've used jQuery's ajaxSend and ajaxStop to show a spinner whenever ajax requests are active. It works except when some of my plugins abort their ajax requests, ajaxStop does not trigger and will not trigger until after the page is refreshed. It seems like the aborted request still counts to jQuery. Can I make ajaxStop trigger or is ther...

redirect a http request using selenium

This is quite a straight forward question that I can't seem to find a comprehensive answer for. When using Selenium and Selenium proxy, how I can make the proxy catch outgoing xhr requests to specific uri's and modify the destination to a pre-mocked alternative. I found this example form googling, http://www.sonatype.com/people/2009/10/s...

Is it possible to perform a cross site site request forgery attack on a URL that returns a JSON object?

I'm aware that there is a Cross site forgery attack that can be performed on a request that returns an array by overloading the Array constructor. For example, suppose I have a site with a URL: foo.com/getJson that returns: ['Puff the Dragon', 'Credit Card #'] This would normally be Javascript eval'd by my own site after an XHR re...

Asynchronous cross-domain GET requests

Does anyone has any solutions on accomplishing asynchronous cross-domain GET requests. I am looking to make a site that checks available names of other sites. The faster the better. I'd like it to use my server if possible, as its most likely faster than the client. Would most likely send it a huge array (300-10000) requests. Examples,...

Set a breakpoint in XHR in Chrome

I have a page that sends an XHR request when a form is submitted and I would like to get Chrome to break when it receives a response. It seems like the best way to accomplish this would be if Chrome has a javascript function that I can call that breaks execution but I've been unable to find anything like that so far. Is there another sol...