TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mehul Prajapati
NA
1.3k
45.8k
chrome.runtime.sendMessage error “Message length exceeded”
Jan 20 2018 7:43 AM
When i am sending big size of json object from content.js to background.js usingchrome.runtime.sendMessage then showing error like
Error is : Uncaught Error: Message length exceeded maximum allowed length.
Content.js
var
ServerPath =
"http://localhost:62513/api/account"
;
chrome.runtime.sendMessage({
method:
'POST'
,
action:
'xhttp'
,
url: ServerPath +
"/rapdata"
,
data: JSON.stringify({ data: data, fileName: fileName })
},
function
(responseText) {
//alert(responseText);
console.log(
"response of call saverapdata method"
);
/*Callback function to deal with the response*/
});
Background.js
chrome.runtime.onMessage.addListener(
function
(request, sender, callback) {
console.log(
"background js onMessage call."
);
var
resp =
"done"
;
if
(request.action ==
"xhttp"
) {
debugger
;
//alert(request.data);url: ServerPath + "/rapdata",
var
ServerPath =
"http://localhost:62513/api/account"
;
$.ajax({
type:
"POST"
,
url: request.url,
data: request.data,
contentType:
"application/json; charset=utf-8"
,
dataType:
"json"
,
success:
function
(data) {
debugger
;
console.log(data);
//alert("Data: " + data);
},
failure:
function
(response) {
debugger
;
console.log(response);
///alert(response.d);
}
});
return
true
;
// prevents the callback from being called too early on return
}
});
Reply
Answers (
1
)
connect html,javascript or css
Here i am getting output as undefined, please tell me why