Chrome extension select folder for several downloads - google-chrome-extension

I'm working on a chrome extension that scrapes pages and downloads images within the page. However, I've run into a sort of roadblock.
Since the extension is designed to download several files at once, I'd like for the user to be able to click the 'Download' button, select a folder, then download all the images to that folder.
So far, the only thing I've seen that might be of use is the saveAs option in chrome.downloads.download(). However, it would be very tedious for the user to have to select a location and confirm for every file. Is there a way I can have the user select a folder, then just download all the files to that specific folder?
Let me know if I need to include any specific code. Figured it wasn't very important, since I don't even have code pertaining to this question currently.

Unfortunately you cannot. Your options are
Ask the user each time
Save the files to the downloads folder set by the user or a sub folder
Although much more complicated you could use native messaging and have native code communicate with the extension. You could then wait for the extension to complete the download and then send a message to your native host with the full path. Then your native host can move the file to where you want.

Related

Node-Webkit file download progress

I have the following link in my Node-Webkit app
<a id="updateAppVersion" href="http://<some_path>/newVersion.zip">New version available</a>
This link works fine, it displays the 'save as' dialog and the user can save the file normally.
My question is, is there an easy way to display the download progress inside the app like browsers do or i need to create my own? (if so how?).
Currently nothing is displayed when the user chooses the download location.
I don't think that nwjs includes this feature. If you choose to write your own mechanism, try request-progress:
Tracks the download progress of a request made with mikeal/request,
giving insight of various metrics including progress percent, download
speed and time remaining
check this answer for more options.

How to modify Chrome Extension, which authenticates every user through Google's OAuth 2?

I am trying to modify a small thing from an extension. All I basically need to edit, is the selector they use. If their selector is $("#firstDiv") I need it to be $("#secondDiv"). It is really that simple.
I downloaded the CRX file, extracted it, made the edit, but when I go and install it in my browser, it asks me to authenticate with Google Authenticator. Just like it's supposed to do, as it uses oAuth 2. HOWEVER, once I log into my Google account, it will not "save" the login. Right after I log in and press Log In, the tab closes and launches the same login page again on another page.
Is it possible to change that somehow? I found a semi-workaround. If I install the extension, authenticate with Google, then go make my edit in the extension folder, it works perfectly. However, I cannot send it to someone else, because the manifest.json includes my authentication key (392 characters long).
How can I modify the extension to my needs? Is there something I need to know about Google OAuth?
EDIT: Okay, I cannot even download the .crx file directly from Google, unzip the file, then move the files into a new folder, and install that script. Exactly like it came from Google. Are their .crx files signed? Is it impossible to do this?
When you download the .crx file, extract it, edit it and install it, its extension id is changed from the original one(this is the reason you are getting login page again and again). Now, client id used in extension is valid for only the original extension id. Thats why when you install it from web store it works fine because it retains its original extension id.
Solution :
You must retain the original extension id to make it work. First download crx viewer(very helpful for extension developers)
After installing crx viewer, navigate to your extension from web store. You will notice a page action(icon at the end of url). Click it , then click view source. New tab will open, then press f12 and check the console, you will find a "key" value. Copy it. Now go to your extension page again and download the extension as zip(from crx). Extract it and open its manifest.json file and paste the "key" along with value.(This step is necessary to retain extension id). Now install the extension from chrome by enabling developer's mode and clicking load unpacked extension and selecting the extracted extension. It should work now

How to launch windows applications from a website

I want to know if it's possible to launch windows applications from a website. If it is possible, how? Sort of like battlelog for battlefield, when a button is pushed it opens an application.
Edit: This is for personal use
Try this:
Make each button be a link to download a company template file for the given application. For example, the "Excel" button would download and the user should be prompted to open it with Excel.
For instance, try clicking one of the links here:
http://www.google.com/#sclient=psy&hl=en&q=template+filetype:xls
Linking to static files on the web server should be sufficient, so long as your server sends the correct MIME-Type or Content-Type.
HOPE it helps!
Take a look at this thread. it should point you in the right direction. In short you can do this in IE using ActiveX objects. But I must warn you that it is a very bad idea

Is it possible to download all the files from a parent directory without manually clicking on each link?

Is it possible to download all the files in a parent directory?
I'm trying to download all the files here:
http://linux.mirrors.es.net/centos/5.6/isos/i386/
Download how? You can use a browser extension like Firefox's DownThemAll to grab all links on a page, though it's more optimized for media types by default (you can specify your own file masks, though).
You can use wget with the recursive option. There are also many shareware apps that provide GUIs for sucking down the contents of a website.

IE6 download dynamic excel blocked by firewall

I've created a tool that allows the client to dynamicly create a excel document based on the selected products. For this functionality I used PHPExcell. I've tested it on almost every browser and it's working fine (even in IE6).
The problem starts with the clients network, its a big company so they can't choose what browser they're using and they're stucked with IE6. Everything works fine except the excel download. After the generation a popup shows what they want to do (save/open) but when they press one of them a error occurs (could not acces file or file path could not be found or something like that). At the same time they get a warning from mcafee that a they're trying to open a unsave file.
When they try it on a http server it only happens once, when they go back to the page after the error everything works fine, even the excel generation.
But the error keeps coming on the https server, so they can't use it.
How to avoid / work around this? Is it even possible?
My guess is that the workbook is being built in a temporary internet files folder and the system is refusing to let them copy an open temp file to some other location on their system (as it should). You should try to arrange for something that will ask for the download location before hand and dynamically build the file from there.

Resources