Chrome Extension message passing: Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist
My chrome extension has the following two javascripts: background.js, running as background script: chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { if (message.data == "takeScreenshot") { var resp = sendResponse; chrome.tabs.captureVisibleTab(function(screenshotUrl) { resp({ screenshot: screenshotUrl }); }); return true; // Return true to tell that the response is sent asynchronously } else { return "TestReply"; } }); api.js, running as web accessible resource: window.takeScreenshot = (function() { var isTakingScreenshot = false; // Semaphore return function() {
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.