Obtain cache files chrome extension - javascript

Is there a way to obtain/read cache files using a chrome extension without NPAPI but javascript?
I have tried searching with NPAPI but I am unable to find a good tutorial on it or how can it be done using NPAPI.

Javascript is restricted from accessing the filesystem in all cases that I am aware of, though I admit that I don't know much about Chrome extensions.
The only way I know of to access arbitrary files would be with an NPAPI plugin as part of the extension. If you decide to go this route, I suggest you look at FireBreath, which is an abstraction that simplifies and solves most of the issues people run into with NPAPI plugins.

Related

How can I get installed chrome extensions list with javascript

I have a web site made by Python Django.
And I want to check if a visitor's chrome browser's chrome extension is installed.
I found some information, it looks possible with Javascript.
https://www.python2.net/questions-993829.htm
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/management/getAll
They say you can get all installed chrome extensions by writing it like this.
chrome.management.getAll() or brower.management.getAll()
But When I tried that "chrome.management" is not defined.
Is it need to add library to use chrome.management?
I read the API documents, But I didn't know How can I to do.
Please teach me if you know about this. Thank you.
From the looks of chromes docs (https://developer.chrome.com/docs/extensions/reference/management/), it seems that chrome.management is only able to be used in chrome extensions with the management permission. There doesn't seem to be any real alternative for websites. (Although if you own the extension you might be able to create a hidden div with a specific id, then the website could detect that).
If chrome did allow websites to see this it would also make fingerprinting much easier.

Node.js Automate Login and Upload

I currently have a node.js script that automatically creates a group of files and then zips them ready for being uploaded on a site. I'm trying to add one extra piece of functionality to the script that will log into the site and upload the file itself.
I've done some reading around and found a lot about headless browsers but not sure if that's the right path to go down as they seem to rely on other applications like chromium and they're focused on testing sites.
Does anyone know where I should start looking?
In my current project I am using the following library from Google, puppeteer. I personally found it to be very easy to use, and it even provides access to the dev protocol that Google Chrome has.
I've done some reading around and found a lot about headless browsers but not sure if that's the right path to go down as they seem to rely on other applications like chromium and they're focused on testing sites.
Yes, they are often used for testing, to assure that the correct things are rendered on screen etc. However, in many scenarios, like yours, the use of a headless browser to interact with a website is totally legit in a non-testing scenario.

Regarding Jquery/Javascript and NPAPI chrome issue

I use a lot of JQuery and normal javascript on my sites.
Mainly I use validate, auto form fills, sliders, lightbox, loading php files in elements etc.
I have searched the web but cannot get my head around this.
Will I be affected by the new chrome policy about NPAPI and Java?
http://blog.chromium.org/2014/11/the-final-countdown-for-npapi.html
Despite the name, JavaScript is not related to Java at all. JavaScript got its name because its first versions were due to be released at around the same time as Java's, and the marketing team at Netscape (the company where JS was first developed) thought it would be a good idea to market them together. That didn't work out as well as anyone had hoped, but the name stuck.
NPAPI deprecation has almost nothing to do with JavaScript. It affects Java applets because Chrome (and Firefox) implement those using an NPAPI plugin, but JavaScript is a completely different beast, and it is not implemented that way.
The effect of NPAPI's deprecation on JavaScript isn't quite zero, but it's close. The only scripts affected by NPAPI deprecation should be scripts that actually depend on NPAPI plugins to work. For example, TiddlyWiki used to depend on an NPAPI plugin to save its contents, but NPAPI deprecation prevents that, so it had to find another way to work on that browser.
It doesn't sound like you're doing anything that uses NPAPI plugins, so your scripts should be fine.

Implementing Boomerang into a browser extension/plugin

I am currently developing a browser extension/plugin that one would install and would then report information such as page load times, number of objects on each page, etc. to a server so that the data could be analyzed.
I was curious if something like Yahoo's Boomerang JavaScript code (http://hacks.bluesmoon.info/boomerang/doc/) would be able to be able to do this. From what I have read, it seems like Boomerang was developed for developers to implement into their own website in order to gather data, but would I be able to gather the same kind of data by putting this code in a browser extension in order to gather the data from each website that is visited?
The link you're using for boomerang is very outdated (it was my first experimental page). Use http://lognormal.github.com/boomerang/doc/
Boomerang does already use these APIs, and much more, but as a browser extension, you could do much more in terms of removing code that supports other browsers, and also maintaining offline storage more efficiently than boomerang's cookies.
FWIW, yslow already does most of what you want, so maybe just use that (it was built by the same team)
I don't see why not from a technical perspective, at least in Firefox and Chrome. However, user privacy issues and policies of the browser extension stores might prevent you from tracking users in certain ways and/or without consent. So better check that first to avoid surprises later.
You'd need a way to gather information. Judging from your question text, the regular DOM APIs and the PerformanceTiming API might be sufficient. And that's probably what Boomerang uses already.
You'd just attach your code (or Boomerang) with e.g. Firefox Add-on SDK PageMod or Chrome extension Content Scripts.
You'll also need to transmit the data somewhere. Both Firefox (XUL1, Add-on SDK) and Chrome extensions allow cross-origin XHR.
So there you are. ;)
1 XUL overlay scripts are privileged, and not restricted by the same-origin policy.

Understanding browser plugins: creation, deployment, and use

Let's say I wanted to create a browser plug-in that would open someone's floppy drive for them whenever they click a button on my web page. (You remember that old gag? - Don't worry, I don't really want to do that.)
What are the steps necessary to create a browser plug-in that will work on most browsers and most operating systems?
How do I deploy the plug-in? For instance, how do I make it so that the plug-in can be easily downloaded and installed? Do I have to worry about digital certificates?
How do I check for and use the pluggin once it's installed? Is it available to javascript in the form of an API?
Take a look at a project called FireBreath: http://www.firebreath.org/display/documentation/FireBreath+Home
Firebreath abstracts many of the differences between the browser plugin frameworks and platform issues so you can easily write the code for a plugin once and just re-compile it for different platforms.
I have found it good for exposing existing C/C++ library API's to Javascript so I can write dynamic pages that use functionality from the C++ library which were otherwsie not available.
Most modern browsers have their own plugin frameworks for developers to utilize. So, for example, a Firefox plugin will not work in chrome or IE. Firefox and chrome do both utilize javascript and css but they are fundamentally different in their structure.
As far as deployment, Mozilla and Google provide hosting for their respective plugins. I do know that firefox extensions are basically zip files with the extension changed.
EDIT...
I had assumed you meant browser extensions so disregard my answer if that is not the case.
The easiest cross-browser solution is use Java Applets or maybe Flash (I am not sure how you do it in Flash).
With applets, you would need to sign the applet and also create a security policy file for accessing the disk. When the applet loads in the browser it would ask permission from the client user, he/she needs to click Allow to give permission for the applet to access the disk. This would allow you to access any disk in the system.

Categories

Resources