Detect when user focus on browser address bar - google-chrome-extension

In a browser extension, is it possible to detect when a user focuses on the browser address bar?
I would like to copy what a user is writing in the address browser bar and paste it somewhere else in my browser extension.|
I couldn't find any documentation neither in chrome nor in MDN
Any tips are highly appreciated!

Related

How to copy all messages from browser developer menu from response code 101?

I have no knowledge of networking and programming. So I will describe what I do and what I want to happen.
I open a browser (for example, Firefox or Google Chrome).
Open the developer menu with the F12 button.
I load a link to a given site in the url bar.
In the developer menu in the Networking tab there is a response with status code 101.
After each click of a certain button on a site, a new row of data appears in the list of web socket messages on response 101.
I can see the raw data for each click of the button and I can copy this data. But I can't copy all data for all button clicks at once.
My question is - how from the response with status code 101 can I copy or extract from a browser the data that the server returns after each click of the button?
[FOR ADMINS]
I don't know if this question is appropriate for this site. If not, please admins move it.
I don't know if the tags I put are correct for my question.
I apologize for my bad English. I use google translate.

Chrome Extension overwrite existing webpage

I will try to make this as short as possible. I am making a Chrome extension and I wanted to have an integrated settings tab so users can customize their experience. Now, I want this settings tab to be somewhat of an "extension" to an existing settings tab in a website. Let me explain.
The website I am talking about is Roblox.com, a popular gaming platform. When logged in, you have the ability to visit your settings, which look something like this:
Now, in order to navigate the different setting "tabs," you simply click on a button and it takes you to another change. The URL corresponding to each page is https://www.roblox.com/my/account#!/TAB_NAME, with TAB_NAME being the name of the tab. What I want to do is make my own "tab" where once the player clicks, it will bring them to a settings tab where they can tweak the extension's settings. This would look something like this:
I am fully aware on how to this (inject a button into the list and customize said button), but what I don't know what to do is make it so that once the button is clicked, it will not redirect you to another website, but will simply "switch tabs" like it would with any other setting. There is an extension that already does that called "Roblox+", where it adds a button to the list, and once clicked, it takes you to a similar-looking page with the URL https://www.roblox.com/my/account?tab=rplus#!/info. From my understanding, since the tab name isn't a header, the URL does not change, which allows for a custom webpage. Now, if you were to paste that URL in a browser without the extension, then it would simply redirect you to the "Account Info" tab (although the URL remains). Here is how the Roblox+ extension settings page looks like:
Now, from what I can assume, what happens is that right after the normal account information page is loaded, it removes all the HTML elements that are related to the account information tab and re-creates the entire page using custom HTML elements. That is something similar to what I want to do. Regardless of this, I do have one question. Is it possible to somehow "overwrite" a certain domain so that, let's say, the URL https://www.roblox.com/my/account#!/my_plugin_settings led to my custom page (even if that means that the page is made from an HTML file) instead of where it was supposed to lead? If that isn't possible, would it be better to create a custom settings page outside of the Roblox website or somehow inject my own into the current settings?
This is the question that I have. Hopefully I explained it well. If someone could assist me on this, then that would be amazing. Thank you for your time and help, I truly appreciate it.

How to open incognito window using extension when user clicks a button on a webpage

I'm working on creating a voting site of some sorts. There will be a laptop at a physical location at my school and one of the pain points I need to solve is that since my site uses sign in with google, it becomes a hassle to sign everyone out and let the next person sign in, so I thought of opening an incognito tab to store session data when someone wants to vote, so that they just need to close the tab to clear their session data. I know that only an extension is allowed to open incognito tabs, and it would require the "tabs" permission, but how would I go about making it so that when someone clicks on the button on my site, my extension opens an incognito window for them to sign in?
let's say for instance when I click
<button id="open_Incognito">Start Session</button> it would open an incognito tab.

Mailto with subject not working

I am building a site in Squarespace. I am trying to add a mailto: link with a subject.
Here's the code I used: mailto:email#myemail.com?subject=Website.
In Firefox and IE, clicking it opens a totally blank new tab. In Chrome, it opens up a blank new tag with the mailto code in the browser window. But the desired behavior is of course to have it open a mail client.
I don't think you can control this. mailto: depends on the user's desktop configuration.
They may have it open in a mail client, gmail or whatever their configuration is. You can't control how the mailto: works.

Chrome extension 2 questions

I have managed with my extension and using ajax call in the content script to call my server and get an answer back. But in the console I get a message like:
The page at https://www.injectedpage.com displayed insecure content from http://www.mywebsite.com/Script.asp
Is there something I can do to prevent this message appear?
One more question please.
If I distribute the .crx to other people, can they see my code in the .js page? I dont want them to know to which page in my server I post the data I send.
Thank you for reading me. And for your patience with me.
The first issue is due to the fact that the website you're injecting code into is https while your page is http. It's a security warning from Chrome that you can't hide.
Yes they can see your extension's complete code. You can obfuscate it but when you publish your extension you give the user the entire code.
If your extension has a popup thing from the toolbar, right click to inspect element and If it has a background page or something, you can inspect it from the extensions page (developer mode has to be checked)
To see all of the files of every extensions, a user can navigate to Chrome's extensions directory. For example, on Win7 it's
C:\Users\[username]\AppData\Local\Google\Chrome\User Data\Default\Extensions
User could also just rename your crx to zip and extract.

Resources