HTML5 Notification not working in Mobile Chrome

Try the following: navigator.serviceWorker.register(‘sw.js’); Notification.requestPermission(function(result) { if (result === ‘granted’) { navigator.serviceWorker.ready.then(function(registration) { registration.showNotification(‘Notification with ServiceWorker’); }); } }); That is, use ServiceWorkerRegistration»showNotification() not new Notification(). That should work on Android both in Chrome and in Firefox — and on iOS in Safari, too. (The sw.js file can just be a zero-byte file.) One caveat … Read more

Combine CSS Attribute and Pseudo-Element Selectors?

This looks like a bug, which has finally been reported. If you add a CSS rule for divCombine CSS Attribute and Pseudo-Element Selectors? anywhere in your stylesheet with at least one declaration, your divCombine CSS Attribute and Pseudo-Element Selectors?:after rule will magically apply. For example: div:after { content: “NO”; } divCombine CSS Attribute and Pseudo-Element … Read more

XMLHttpRequest; Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource [duplicate]

All research into that specific error message suggests that the host web page is not being loading via an http:// URL and is probably a file: URL. The browser will not, by default, permit cross origin requests from a file: URL. You need to load the web page through your web server, not via the … Read more

Cross-domain XMLHttpRequest using background pages

You don’t have to mess with iframes. It’s possible to perform cross-domain XMLHttpRequests, using background pages. Since Chrome 13, cross-site requests can be made from the content script. However, requests can still fail if the page is served with a Content Security Policy header with a restricting connect-src. Another reason for choosing the nexy method … Read more

Accessing `window`/DOM/HTML of the webpage from the extension

Problem: extension pages (popup, options, background page in MV2, etc.) are separate from the web page and they have their own DOM, document, window, and a chrome-extension:// URL. Note that service worker doesn’t have any DOM/document/window at all. To inspect each context of the extension use its own devtools. Solution: use a content script to … Read more

How to get a list of open tabs from chrome? | C#

First Reference two dll UIAutomationClient.dll UIAutomationTypes.dll Located: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 (or 3.5) Then using System.Windows.Automation; and the code Process[] procsChrome = Process.GetProcessesByName(“chrome”); if (procsChrome.Length <= 0) { Console.WriteLine(“Chrome is not running”); } else { foreach (Process proc in procsChrome) { // the chrome process must have a window if (proc.MainWindowHandle == IntPtr.Zero) { continue; … Read more