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) {
-
- console.log("response of call saverapdata method");
-
- });
Background.js
- chrome.runtime.onMessage.addListener(function (request, sender, callback) {
- console.log("background js onMessage call.");
- var resp = "done";
- if (request.action == "xhttp") {
- debugger;
-
- 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);
-
- },
- failure: function (response) {
- debugger;
- console.log(response);
-
- }
- });
- return true;
- }
- });