How does the Brave browser have Chrome’s dev-tools?

Really Quick question:
How does the Brave browser have Chrome’s dev-tools?
followup:
Does that mean I don’t need to test in Brave if my website works in Chrome?

Thanks 🙂

Control Chrome Extensions C#

Is there a way to control an installed extensions on chrome browser? For example – I want to switch a location of VPN I use without manually clicking on the extension and selecting location.

I just can’t find anyting that makes me able to interact with EXTEMSIONS themselves, not the website/etc.

how to put the value of tab.url into a variable?

    var str;

    chrome.tabs.query( {active: true, currentWindow: true} , function(tabs){
        str = tabs[0].url;
    });

    alert(str);

something like this.

But it shows:”undefined”, how could I deal with this? I want it to show the url of this tab.

P.S. I’m a very beginner on this, this is an accident work to me.

Failed to access Google analytics in Chrome extension(not AdBlock issue)

I’m trying to add GA inside my chrome extension. After looking for the newest solution(2014),

  1. Update manifest.json (I update CSP & permission both)
  2. Add script code on the page I wanna track (override.html)
  3. Add tracking code on main js file(I put it inside background page:
    background.js rather than override.js)

I found another issue that there always an error after I open my extension(this is a test version, so I run at localhost). The error message s
hows after loading 10 seconds or longer: Failed to load resource: http://www.google-analytics.com/ga.js

I know that some existing question discuss this issue and the solution may be remove AdBlock, but I never install this tool in my computer……
And I also can’t open “http://www.google-analytics.com/” directly….
hope this problem can be solved…

Or maybe the method is not available now?

Powered by WPeMatico

In Chrome, How to get audit panel score in Javascript

With Chrome 60 in Dev Tools, there is an Audits Panel with some scores (powered by Lighthouse). The scores at the top for Progressive Web App, Performance, Accessibility, and Best Practices are your aggregate scores for each of those categories.

Do you think, it is possible to access these scores with some Javascript code within Chrome?

Powered by WPeMatico

Chrome extension with declarativeContent.RequestContentScript

I am trying to make a Chrome extension, which will monitor GMail and do something when user starts to write a message. After some study of examples and documentation I have figured out that I should do it with declarativeContent, which reacts on page change.

This is what I have done by now.

manifest.json:

{
  "manifest_version": 2,
  "name": "Gmail helper",
  "version": "0.1",
  "permissions": [ "declarativeContent" ],
  "background": {
    "scripts": ["background.js"],
    "persistent": false
  }
}

background.js:

chrome.runtime.onInstalled.addListener (function (details) {
  chrome.declarativeContent.onPageChanged.removeRules (undefined, function () {
    chrome.declarativeContent.onPageChanged.addRules ([{
      conditions: [
        new chrome.declarativeContent.PageStateMatcher({
          pageUrl: { hostEquals: 'mail.google.com', schemes: ['https'] },
          css: ["div"]
//          css: ["div[aria-label='Message Body']"]
        })
      ],
      actions: [ new chrome.declarativeContent.RequestContentScript({js: ["content.js"]}) ]
    }]);
  });
});

content.js:

alert ("Test");

My plan was to declare a content script that would trigger on page changes in GMail. I have added a declarative rule, which has pageURL, css and actions defined. According to my understanding content.js should be executed when pageUrl and css content match. However, content.js is not executed.

What am I doing wrong?

Thanks.

Powered by WPeMatico

How to simulate keypress in JS?

I’m trying to create a chrome extension that modifies the controls of the popular browser game, Agar.io. Quick summary, in the game SPACE performs the split action. I want to perform the same action but by pressing D instead of SPACE. The extension works fine. It detects that D has been pressed and the my split() function is called; I know this because the alert pops up but the actual game action doesn’t perform. I’ve looked around and tried different ways but nothing is working. Below is my JS file.

window.addEventListener('keydown', keydown);

function keydown(event) {
    if (event.keyCode == 68) { //key D
        split();
    }
}

function split() {
    $("body").trigger($.Event("keydown", { keyCode: 32}));
    $("body").trigger($.Event("keyup", { keyCode: 32}));
    alert("Did it work?");
}

Also tried this method with no success:

var space = jQuery.Event("keydown");
space.which = 32;
$("body").trigger(space);

As shown in this question [Definitive way to trigger keypress events with jQuery

]1

Powered by WPeMatico

Access VUEX Store from Chrome extension

I’m writing a productivity extension for Chrome that deals with streamlining some processes of a VUE app.

Is there any way to dump the contents of the VUEX Store into a global variable so that I can read the values from my content script?

I’m assuming I’ll need to inject some JS into the page that will dump the store.state but have no idea what code to use.

Thanks!

Powered by WPeMatico

chrome.storage.sync.set – does developer have access to this data?

I am looking through the code for a chrome extension i use to see what data is reported back to devleoper/mother-ship. I see that the extension’s code saves some info using ‘chrome.storage.sync.set’ which of course makes sense as the variables that are stored there are available to me not matter what computer I load the extension on.

My question is… does the developer have access to this data? I would guess not but wanted to make sure. I have been looking for other code that posts data or does something that could send data back to developer but this was the only thing that looked suspicious so far.

Powered by WPeMatico

pac_script’s proxy works for localhost, however doesn’t work on a live domain

in background process of my chrome extension:

var config = {
    mode: "pac_script",
    pacScript: {
        data: "function FindProxyForURL(url, host) {n" +
        "  if (shExpMatch(url, '*test/*'))n" +
        "    return 'PROXY 127.0.0.1';n" +
        "  return 'DIRECT ';n" +
        "}"
    }
};
chrome.proxy.settings.set({
  value: config,
  scope: 'regular'
}, function() {});

With this code, whenever I visit anydomain.com/test/ it’ll route me to a website I have on my desktop at 127.0.0.1/test/ however, if I change the 127.0.0.1 to a live website with the same trailing folder(that exists), it’ll give me 400 Bad Request

Powered by WPeMatico