Accessing console and devtools of extension’s background.js

You’re looking at the wrong place. These console messages do not appear in the web page, but in the invisible background page (ManifestV2) or service worker (ManifestV3). To view the correct console open devtools for the background script’s context: Visit chrome://extensions/ or right-click the extension icon and select “Manage extensions”. Enable developer mode Click on … Read more

google chrome extension :: console.log() from background page?

You can open the background page’s console if you click on the “background.html” link in the extensions list. To access the background page that corresponds to your extensions open Settings / Extensions or open a new tab and enter chrome://extensions. You will see something like this screenshot. Under your extension click on the link background … Read more

How can I get the URL of the current tab from a Google Chrome extension?

Use chrome.tabs.query() like this: chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => { let url = tabs[0].url; // use `url` here inside the callback because it’s asynchronous! }); This requires that you request access to the chrome.tabs API in your extension manifest: “permissions”: [ … “tabs” ] It’s important to note that the definition of your “current … Read more

Google Chromecast sender error if Chromecast extension is not installed or using incognito

Update: After several attempts, it looks like this may have been fixed in latest Chrome builds (per Paul Irish’s comment below). That would suggest we will see this fixed in stable Chrome June-July 2016. Let’s see … This is a known bug with the official Chromecast JavaScript library. Instead of failing silently, it dumps these … Read more

How do I auto-reload a Chrome extension I’m developing?

You can use “Extensions Reloader” for Chrome: Reloads all unpacked extensions using the extension’s toolbar button or by browsing to “http://reload.extensions” If you’ve ever developed a Chrome extension, you might have wanted to automate the process of reloading your unpacked extension without the need of going through the extensions page. “Extensions Reloader” allows you to … Read more

How to wait until an element exists?

Here is a simple solution using the MutationObserver api. No jQuery No Timer No third party libraries Promise based and works well with async/await I have used it in several projects. function waitForElm(selector) { return new Promise(resolve => { if (document.querySelector(selector)) { return resolve(document.querySelector(selector)); } const observer = new MutationObserver(mutations => { if (document.querySelector(selector)) { … Read more

Is there a JavaScript / jQuery DOM change listener?

For a long time, DOM3 mutation events were the best available solution, but they have been deprecated for performance reasons. DOM4 Mutation Observers are the replacement for deprecated DOM3 mutation events. They are currently implemented in modern browsers as MutationObserver (or as the vendor-prefixed WebKitMutationObserver in old versions of Chrome): MutationObserver = window.MutationObserver || window.WebKitMutationObserver; … Read more

Getting “net::ERR_BLOCKED_BY_CLIENT” error on some AJAX calls

AdBlockers usually have some rules, i.e. they match the URIs against some type of expression (sometimes they also match the DOM against expressions, not that this matters in this case). Having rules and expressions that just operate on a tiny bit of text (the URI) is prone to create some false-positives… Besides instructing your users … Read more

Chrome sendrequest error: TypeError: Converting circular structure to JSON

It means that the object you pass in the request (I guess it is pagedoc) has a circular reference, something like: var a = {}; a.b = a; JSON.stringify cannot convert structures like this. N.B.: This would be the case with DOM nodes, which have circular references, even if they are not attached to the … Read more

Use a content script to access the page context variables and functions

Underlying cause: Content scripts are executed in an “isolated world” environment. Solution: Inject the code into the page using DOM – that code will be able to access functions/variables of the page context (“main world”) or expose functions/variables to the page context (in your case it’s the state() method). Note in case communication with the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)