Access Local Files using a Google Chrome Extension

The Humble Rat

I have asked a similar question to this previously

Communicate with Cash Drawer from Website

However the question was very vague and I now know what I require is possible using an extension.

This question is similar to the following, however, not quite the information I need.

Chrome extension and local storage

Access local files through Google chrome extension?

List a local directory with chrome extension

What I effectively need to do is run a bat file on the users computer from my website. The users of the site will be employees of the company and the computers they will be using will be provided by us, therefore I can make any necessary changes to the machines for this to work before shipping to the user.

I understand that you can create a local folder on the computer that you can allow chrome to have access to, therefore maintaining security. I have searched for how to do this but cannot seem to nail down what I need to search for and this in particular is where I need help.

http://developer.chrome.com/apps/fileSystem

I have not yet built an extension but I am willing to take on the challenge so I do not need help with this side of things. The two guides below seem more than ample.

http://lifehacker.com/5857721/how-to-build-a-chrome-extension

http://css-tricks.com/colorpeek-part-2-building-first-chrome-extension/

This is where I am currently at.

{
  "name": "Open Till",
  "version":"1",
  "manifest_version": 2,
  "description": "Allow POS Users to Open their Till",
  "browser_action": {
    "default_icon": "icon.jpg"
  }
}

What I need to achieve next is to create a command to call the extension, the extension then to navigate to the local folder that chrome can access to and then execute a batch file.

I realise I could work around the need for the chrome folder by using the npapi plugin

https://developer.chrome.com/extensions/npapi

However, this is apparently a potential minefield so I would not like to do this.

If someone can point me in the right direction of how to create the folder and access the file, this would be most appreciated.

Alon Gubkin

You are going to need to write a Chrome extension that exposes an API to your website. This is the easy part. You inject a content script to your website, and then use chrome.extension.sendMessage to communicate back to your extension.

The hard part is to actually open the bat file from your extension. With NPAPI, this would have been easy, since you could just write a C++ plugin that calls CreateProcess or something. Contrary to what you said, it's a pretty good solution. But unfortunately, NPAPI isn't an option, since it's being deprecated.

So what you should do is to use Native Messaging. Basically, it's a Chrome API that allows extensions to exchange messages with native applications using standard input and output streams.

Read more about it here: https://developer.chrome.com/extensions/messaging#native-messaging-host

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Using Google Charts in Chrome extension

From Dev

Google Chrome extension - download, move and delete files

From Dev

How can I override javascript files referenced with the crossorigin="anonymous" using a Google Chrome extension?

From Dev

Redirect to url Using Google chrome Extension

From Dev

Defining a hotkey in Google documents using Chrome extension

From Dev

Access local web files via Microsoft Edge extension

From Dev

Open local files(file://) using Chrome

From Dev

Using Chrome auth to access gmail api inside of a Chrome Extension

From Dev

How to write a configuration file for chrome extension using a local script

From Dev

Accessing local storage in CSS when using a chrome extension?

From Dev

Access Google Cloud SQL database from Chrome extension

From Dev

Can't view chrome extension local storage from developers tool but can access it from extension api

From Dev

How to minify my google chrome extension's javascript files

From Dev

Chrome Extension Access Xively

From Dev

Chrome Extension Access Xively

From Dev

Authenticate Chrome extension with non-Google API using Google account

From Dev

Upload local files using Google Colab

From Dev

How to access HTML elements using chrome extension/plugin?

From Dev

How to open multiple local HTML files in Google Chrome at once?

From Dev

How To Clear History & Cache in Google Chrome While Leaving Chrome Extension Local Storage alone?

From Dev

angularjs and google chrome extension

From Dev

angularjs and google chrome extension

From Dev

Error with google chrome extension

From Dev

Google Chrome extension malware?

From Dev

Access local Google Cloud Storage files in browser with filename instead of key

From Dev

Injecting jQuery into Google.com using a Chrome Extension

From Dev

Changing the background of the google search page using my chrome extension

From Dev

Using google closure library inside chrome extension content script

From Dev

Is there a way to pass information from Google Chrome using an extension?

Related Related

  1. 1

    Using Google Charts in Chrome extension

  2. 2

    Google Chrome extension - download, move and delete files

  3. 3

    How can I override javascript files referenced with the crossorigin="anonymous" using a Google Chrome extension?

  4. 4

    Redirect to url Using Google chrome Extension

  5. 5

    Defining a hotkey in Google documents using Chrome extension

  6. 6

    Access local web files via Microsoft Edge extension

  7. 7

    Open local files(file://) using Chrome

  8. 8

    Using Chrome auth to access gmail api inside of a Chrome Extension

  9. 9

    How to write a configuration file for chrome extension using a local script

  10. 10

    Accessing local storage in CSS when using a chrome extension?

  11. 11

    Access Google Cloud SQL database from Chrome extension

  12. 12

    Can't view chrome extension local storage from developers tool but can access it from extension api

  13. 13

    How to minify my google chrome extension's javascript files

  14. 14

    Chrome Extension Access Xively

  15. 15

    Chrome Extension Access Xively

  16. 16

    Authenticate Chrome extension with non-Google API using Google account

  17. 17

    Upload local files using Google Colab

  18. 18

    How to access HTML elements using chrome extension/plugin?

  19. 19

    How to open multiple local HTML files in Google Chrome at once?

  20. 20

    How To Clear History & Cache in Google Chrome While Leaving Chrome Extension Local Storage alone?

  21. 21

    angularjs and google chrome extension

  22. 22

    angularjs and google chrome extension

  23. 23

    Error with google chrome extension

  24. 24

    Google Chrome extension malware?

  25. 25

    Access local Google Cloud Storage files in browser with filename instead of key

  26. 26

    Injecting jQuery into Google.com using a Chrome Extension

  27. 27

    Changing the background of the google search page using my chrome extension

  28. 28

    Using google closure library inside chrome extension content script

  29. 29

    Is there a way to pass information from Google Chrome using an extension?

HotTag

Archive