Chrome extension to copy data from a specific location from each tab - javascript

I have a task where in we have specific data of an element open in a webpage and there are multiple elements data opened in multiple pages. The data I need is located at a same location in each webpage. I need to copy the entire row of that data and as sson as I flip the tab by Ctrl + tab the next data of next element should be copied too and in the end I need to export them in an excel file.
I would appreciate if someone can tell me how do I go about it.
I want this to be done as a browser extension.

You can enable a Chrome extension allowing you to execute any Javascript of your own on any website.
For example this extension "Custom JavaScript for websites" : https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija
You Copy/paste in the textarea of this extension your Javascript such as mydata = $("#element_i_want_to_copy").text(); console.log(mydata);
You can then retrieve in Chrome console the data...
If you want that the Javascript on every page send the data on a page of your own that will centralize automatically all the data sent by each Chrome tab loaded page, then you can use online (free) services like "Pusher", cf https://pusher.com/.
The Chrome extension "pushes" the data on your html page, that "receives" the message and displays it in a textarea for instance or a html of your choice...

Related

How to inject text from browser extension to web page?

I am creating a Firefox extension with React.js and want to inject a text into the active website. The permissions, content_script and background script are set in manifest.json but the problem is I do not understand the concept how it should work.
So far I tried to add content script but that runs a script at page load and thats it. The background does not seem to interact with the page.
I need a script that listen for an event, when I click on a button in the extension popup, it should send the text from the React app to update the site. Basically like a password manager when you injecting the password into the form field.
Can someone tell me the concept as I do not get what case relevant to my problem after checking in and out the web extension documentation?

NS binding aborted shown in Mozilla Firefox for Google Apps Scripts

I'm coding a little program by Google Apps Script which loads the data out of a Google Sheet and puts it into a few tables (see first two images).
After the page has been loaded, you can edit the data and store it back into the Google Sheet. The App runs pretty well, except on Mozilla Firefox.
Every time I want to save my data, Mozilla Firefox shows the notification "NS binding aborted" (see the third image).
I already set up a random version behind the URL (https://script.google.com/macros/s/A.....pd/exec?v=5911) but the problem is still there...
PS.: When I hit the "Speichern / Save" Button the script saves all values into a variable and sends the variable to the server where the google sheet is stored. After that, it reloads the page by clicking on an HTML-Link which is hidden at the bottom of the HTML-page.
Has somebody an idea how I can solve this problem?

Chrome Extension: Is there a way to execute popup.js before clicking on the extension icon?

What I'm trying to do:
I'm building a chrome extension that has a popup, an options page, and content scripts. So far, I'm able to store preferences set on the options page and get them using popup.js. The popup.js makes a couple of public API calls to get some information X.
What I'm stuck on:
I need to be able to run/execute popup.js when the DOM loads, before the extension icon is clicked, so that information X can be injected into the DOM via the content scripts.
My question:
Is there a way to execute popup.js before clicking on the extension icon? (Right now, the content scripts loads fine displaying information X, after the the extension icon is clicked)
chrome.storage is fully supported for content scripts, so there is no need to communicate the user preferences from the options page to the content scripts via popup.js or background.js.
With this in mind, I'm able to access user preferences directly to make the API calls in the content scripts, using storage.sync

Opening popup in new tab

So I recently implemented a chrome extension to grab images in an active tab and extract them to a popup for downloading. I would like to give users the option to view the popup window (including the extracted images) in a new Chrome tab.
However, since the popup is created dynamically by appending children to the body of my popup.html, I'm not sure how to pass the HTML for my popup to the new chrome tab.
I tried using chrome.tabs.create({url: chrome.extension.getURL('popup.html#window')});
as found at Open chrome extension in a new tab
but this doesn't seem to be working. Any suggestions?
I'm also developing a Chrome Extension that involves saving down a user's browser data.
Since each time an Extension opens a page (such as popup.html in your case) it opens a new instance of it, the pages and their relevant activity will be independent from each other.
In short you will have to implement some storage. The silver lining is it's pretty simple. Everything you need from manifest to example functions is here:
https://developer.chrome.com/extensions/storage
In your case what I'd imagine you'd want to do is this:
When you pass image urls to your popup page you also save them as items in an array in storage.
Then your pop up page can load in the array as the list to set downloading (or preview depending on use case).
Then either users can delete items from the array, or they are deleted programatically once downloaded.
I can't really be more specific without knowing exactly what your extension is trying to do or how it works, but hopefully that's enough to set you in the right direction.

Put Information form Content Script into popout.html- Chrome Extensions

I wrote a content script for a chrome extension that parses information from a website and displays them to the user. I can see this information if I console log it so I know the script is getting the information I want, but I don't know how to send that back to the popout I made.
So for example I have a line that pulls the header from a website the user is on
titlearea = document.getElementById("titlelarge").innerText;
However when I try to set the the title element in my popout.html file to titlearea nothing happens. Obviously the information isn't getting there. How do I transfer all the data I collect?
-Thanks
in you content script, send the data you want to show to popout page with sendMessage API
then you can show the data:)

Categories

Resources