I have written a NPAPI plugin(using Npruntime sample), I want to use this plugin to get DOM details of the current tab opened in Chrome browser. I am planning to use content script to get DOM details. Is there any other way better then this?
I am new to this.
Related
I'm creating a extension and here is what I want to do.
I have site "www.aaa.com" and the extension I developed can read and navigate DOM element by javascript. However, when I click the extension icon, I'd like get and read the HTML source from "www.bbb.com".
The current page is "www.aaa.com", but want to get the source of "www.bbb.com" in the current page.
How can I do this??
Is there a way to write addon options page in new Firefox WebExtensions API?
For example Google Chrome supports manifest key "options_page"
I searched through documentation and wiki but can't find anything on this point.
This answer is out of date as WebExtension support expands.
See Implement a settings page on MDN (and please upvote this answer for providing this link first).
It does not seem like "options_page" manifest key is supported as of now.
Its main use is providing UI discoverability of the options page; a link to it in the extension list, for instance.
If you're porting an existing extension, you'll need to add some other UI in your extension to open the page (e.g. a link in the popup, if the extension has one). You can simply open it with chrome.tabs.create like you would open any page and it will work identically.
A little caveat: if the extension uses OptionsV2-provided CSS styling, you'll need to compensate for its absence.
Another caveat: the chrome.runtime.openOptionsPage() function is not available in Firefox and should be replaced by a shim using chrome.tabs.
Use the options_ui key in your manifest.json. There is nice guide on MDN on how to do this - Implement a settings page.
Both "options_page" and "options_ui" will be implemented in Firefox WebExtensions!
Here is the link for tracking progress http://arewewebextensionsyet.com/#options
In my Google Chrome extension, I need to be able to get the current page HTML, including any updated Ajax HTML (unlike the browser's View Source command, which doesn't update it).
Is there a way to get it as a string in my Extension?
Suppose my extension is a right-click context menu called "View Actual HTML Source" which should print the current HTML to the console, or maybe count the number of certain tags there. I wasn't able to find an easy answer to this.
You can get the current state of the DOM as HTML programmatically using document.documentElement.innerHTML
Or just use Developer Tools
I followed the exact solution here, and this gave me the Page Source HTML:
Getting the source HTML of the current page from chrome extension
The solution is to inject the HTML into the Popup.
i am writing a NPAPI plugin for that i am using NPSIMPLE sample code from google chrome. i have to get the DOM of web page opened in the chrome browser. My plugin solution also includes background.html file. which when i open in chrome browser calls a method in NPAPI plugin. so my plugin can get the URL of this file. now i want to read the DOM structure of this File.
i have few questions:
when a new page is opened in browser by user how i have to embed my plugin to that page and get the DOM of that page?
whenever a new tab is opened how can i get the notification in My plugin?
How to get the DOM mutation notification to my plugin?
Does NPAPI provides API to get the DOM mutation notification or Content Script is the only option? if content script is the only option then how to establish communication between plugin and content_script?
i am trying to get this answers as well. any help greatly appreciated...
thanks in advance...
1) The only way you could do this automatically would be to put the plugin inside an extension and do it with the extension.
2) You can't, since plugins don't know anything outside of the page they are in. You might be able to jury-rig something using an extension, I suppose, but I'm not sure if that's possible or not.
3 and 4) Your best bet is probably to figure out how to get these notifications with javascript and inject javascript that will call back into your plugin.
Sounds like one of your main sticking points is that you aren't clear on what a plugin can do; you may want to read up a bit.
I need to create a software solution, that will use browser capabilities to perform some tasks.
More specific, i will need to do the following:
Load some page (by URL)
Analyse generated content (DOM), i need to access dynamically generated page, not just initial HTML document
Do a screenshot of some region of the page and save it to a file
What is the best way to do this?
What existing browser would allow me to do this and how exactly? Generally i prefer Google Chrome or Mozilla Firefox.
You can do that using casperjs
It will allow you to load a webpage, then capture any area and save it to a file.
It allow also to play with DOM
You can create a Google Chrome extension to do that.
1.In the extension, you can load page or add listener to observer the tab activities.
2.You can execute scripts on the page loaded,even use jQuery to Analyse the dom.
3.You can use chrome.tabs.captureVisibleTab function to take a screenshot,And then use canvas to handle the screenshot image.
more details about Chrome extension develop:https://developer.chrome.com/extensions/getstarted.html