Hi all,
I'm in a situation where I make an API call to retrieve an image URL. Once I have this image URL I exectute the following regular JavaScript code (this.thumbnailURL is a url which resolves to an image which I want to load into my AIR application):
_loadImage: function() {
this.image = new Image();
this.image.src = this.thumbnailURL;
if (this.image.complete) {
this._onImageLoad();
} else {
dojo.connect(this.image, "onload", this, "_onImageLoad");
}
},
_onImageLoad: function() {
this.imageNode.src = this.thumbnailURL;
this.imageNode.style.display = "inline";
},
Its pretty simple. The this.imageNode.src is a simple image tag and I'd like to set the src attribute of this dom node to this.thumbnailURL once the image has been loaded.
My question relates to setting the referer header for this image load and whether its possible with the code I have outlined above. For regular API requests I've set the referer header as follows (and this works fine)
var req = new air.URLRequest(url);
var headers = new Array();
headers.push(new air.URLRequestHeader("Referer", "http://mywebsite.com"));
req.requestHeaders = headers;
but, as the image loading doesn't really involve a air.URLRequest, I'm not sure how to set the referer header for the image request.
Any ideas?
Sean