This is the error:
Message: Object required
Line: 2
Char: 5
Code: 0
URI: xyz.com/content/js/fineupload/iframe.xss.response-3.6.4.js
This file just have 5 lines:
(function() {
var match = /(\{.+\}).+/.exec(document.body.innerHTML); <- GENERATES ERROR
if (match) {
parent.postMessage(match[1], '*');
}
}());
Do we need this file? If yes, why does it generate error?
I am using the latest version.
Thanks
You should not be including that file in your client-side source code. It is meant to be returned as part of a text/html response to a cross-origin upload request from IE8 or IE9. More info in the cross-origin support blog post for Fine Uploader.
Related
There is a URL I am using in a project of mine, that is working just fine. I make a request from one web server, to a different IP address, invoking a page that outputs data in this format:
[{"PhoneNumber":"+123456789","Name":"Mark"},
{"PhoneNumber":"+123456789","Name":"Josh"},
{"PhoneNumber":"+123456789","Name":"Alex"},
{"PhoneNumber":"+123456789","Name":"John"},
{"PhoneNumber":"+123456789","Name":"Sean"}]
And I can get and process that data with a function call such as this:
$.ajax({
url: serverAddress + "/getpeople",
dataType: "jsonp",
timeout: 4000,
success: function(response) {
for(var i in response) {
alert(response[i].Name);
}
}
});
Here is what's confusing me. From what I've learned about JSONP so far, it isn't actually data, but is instead a function. So the response should be wrapped in a function call, such as callback(), and then I could implement a function callback(data) {} in my project to process the data.
But in this case, the data seems to be just JSON data, which I think should cause a cross-origin error to be generated? But it doesn't.
When I try to call another URL from the same server, fetching an ordinary plain text file, then I do get a cross-origin error, which complains in the console:
Reason: CORS header 'Access-Control-Allow-Origin' missing
But the original getpeople URL does not have that header either. When I examine the response headers in Firefox's document inspector, all of the headers are:
Connection: "close"
Content-Type: "text/html;charset=utf-8"
Date: "Mon, 5 Oct 2015 08:29:07 GMT"
Server: "ServerName/1.1.10011.2211"
So:
The data is not formatted as a JSONP callback
It is served from a different IP address than the web application
The response doesn't have a Access-Control-Allow-Origin header
Why does this work?
Is it at all possible to download a file upon an ajax request?
Does it matter if it's same domain / cross domain?
I know it can be done upon redirecting the browser to a URL and setting relevant headers, but was wondering if it can be done when doing an ajax request.
I'm POSTing JSON as the Request Payload to a URL and based on the content of the JSON, I want to send back a specific file.
client.post(url, body: request, headers:{"Content-Type":"application/json"}).then((res) {
if (res.statusCode == 200) {
if ("application/json" == res.headers["content-type"]) {
// parse JSON here
} else {
// download the content if Content-Disposition is set
}
}
}).whenComplete(() {
client.close();
}).catchError((exception, stacktrace) {
print(exception);
print(stacktrace);
showErrorMessage("An Error Occurred");
});
I can see the the correct headers coming back for downloading a PDF, but it's not doing anything if I receive these headers via an AJAX response.
Update - clarifying:
If you click this link, it will do a GET request to Github and download the file: https://github.com/dartsim/dart/archive/master.zip
I'm trying to download the file using a POST request via Dart's BrowserClient.post.
Following is my code
$.getJSON('url',function(res){
pData = res.Response;
if(pData.Header.Message=='Success')
{//some CODE
}else{
alert('some error');
}
}).error(function(){
alert('There is a web service issue...');
});
When the webservice conatins chinese characters the IE goes executes error function.on Network tab i can see the response ..also can see the response code 200 ok .. It works perfectly on chrome.happens when only there are chinese characters .. works perfectly for normal responses ...
IE appears to trigger failure if it can't parse the response as xml/json/text, even if the request was a success,it calls a error function... In this case because of chinese characters may be IE was not able to parse the respone
I am now checking response manually and then excuting the required function accordingly.. as i am using jQuery following is the code i am using to chk ststus code
statusCode: {200: function() {
alert( "Success" );
}
}
into a AJAX function
I faced with following error in Firefox 23(this code works fine in IE and Chrome) during send of XMLHttpRequest:
[Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: <unknown filename> :: loadUiDesXml :: line 1" data: no] { message="Failure", result=2147500037, name="NS_ERROR_FAILURE", more...}
I can't google what 2147500037 error means and this error is very strange for me.
This is a piece of code:
var xmlHttp = new XMLHttpRequest();
if (typeof theFile === "string") {
xmlHttp.open("POST", theFile, false);
} else {
xmlHttp.open("POST", theFile.baseURI, false);
}
xmlHttp.send("");
This code is executed from "onload" handler for body element.
The file variable is "/emWeb_6-0/des/en/ld117/ept.xml", domen origin policy shouldn't prevent this request.
The most strange thing, that I can recieve ept.xml in other pages.
For example, I can recieve this file successfully in the following scenario:
Recieve ept.xml file on page1.
Redirect to page2, recieve ept.xml again
Redirect to page3, recieve some other files, including ept.xml
Redirect back to page1, recieve status.xml, then I try to recieve ept.xml and I get error duting send("")
The network trace is the following:
POST ept.xml
POST ept.xml
POST pch.xml
POST node.xml
POST ftpRslt.xml
POST ept.xml
POST status.xml
POST status.xml
I can't execute xmlHttp.send("") here.
This code works inside frame, I think that it can be related with the error.
Can anyone explain what is the root cause of this?
UPDATE: Found, that there is error in HTTP response for this file:
XML syntax analysis error : address: moz-nullprincipal:{48eaaeb4-b5f1-4557-931a-88cfd0c372c5} Line 1, char2:
But I can resend thhis request and it works after that.
I have a template like this:
<img class="picto"
ng-repeat="module in modules"
ng-src="{{module.Source}}"
title="{{module.Title}}"
ng-click="module.handler();"/>
When I set the $scope.modules array using static code, everything works fine, and the images are fetched via GET using media type "image/gif" (for gif files). However, when I retrieve the same array using $http.get() - see the code below -, angular tries to retrieve the images using media type "text/html" which results in an 404 error:
$http.get('/api/modules', {})
.success(function (data) {
$http.defaults.get = { 'Content-Type': 'image/gif' }; // apparently useless
$scope.modules = data;
for (var module in $scope.modules) {
$scope.modules[module].handler = function () { alert(this.Id); };
}
delete $http.defaults.get; // ...useless
});
Trying to add a header default did not help either (// apparently useless). Can you see what's wrong?
Try it with Accept: 'image/gif' instead of Content-Type: 'image/gif'.
The Content-Type header describes the data format you are sending to the server. The Accept header describes the data formats you accept in response from the server.