-3

Possible Duplicate:
A simple hello world NPAPI plugin for Google Chrome?
How to open a file which includes in Chrome extension by C/C++?

originally i wanted to develop a chrome extension to open a file on the user's pc.

I wanted to use php fopen some SO users said that I have to use NPAPI instead and said that this is a duplicate question and deleted my question.

I just want to know why can't I use fopen? And if i really don't have other options, then how to open a file using firebreath?

When i go to this section of the docs i don't see the snippets.

i know that moderators gonna come to my question saying that this is a dupe and link to this question I'm one step ahead lol

I don't understand a thing from the accepted answer and i don't understand what file he edited.

the second answer give this link but i can't see the snippets! can you?

I'm on linux mint 12, 32 bit

let me change the question. Can i do this in java? Flashgot got some jar files in the source code :)

install flashgot using chrome, a file called flashgot-1.3.9-tb+sm+fx.xpi will be downloaded, change that to flashgot-1.3.9-tb+sm+fx.zip unzip it and go to the chrome folder

Can i do it in python? every linux distro has python by default

Community
  • 1
  • 1
Lynob
  • 5,059
  • 15
  • 64
  • 114
  • i prefer to do it in php if i can or ajax... the point is, i don't want to use npapi unless i really have to – Lynob Mar 01 '12 at 23:28
  • If you want to get questions answered, it usually helps to avoid swearing... The style of the linked page is apparently broken in Chrome, but fine in FF. – Georg Fritzsche Mar 02 '12 at 05:35
  • @GeorgFritzsche if you believe that the question should be edited, feel free to modify it as you wish sir – Lynob Mar 02 '12 at 08:04
  • If you don't understand an answer to a question, post a comment on the answer asking for more details, don't post a duplicate question with a rant. – smorgan Mar 02 '12 at 08:56
  • @smorgan if i post a comment then the user may not answer, I'd rather ask my own question and have more users looking at it, I'll have bigger chance to get an answer – Lynob Mar 02 '12 at 09:12
  • @smorgan the dupe ypu posted has 2 answers the first answer has link to how to create a ff extension and the 2nd answer has a link that does not work...i want to build a google chrome extension so why would i learn how to create a ff extension? – Lynob Mar 02 '12 at 09:15
  • @GeorgFritzsche hahahaah the guy ever!! you made my day :D anyway I want to change the question a bit otherwise I'll be getting dupes all day long lol!! **CAN I DO THIS IN JAVA???** [Flashgot](http://flashgot.net/) has some jar files in the source code! – Lynob Mar 02 '12 at 09:40

2 Answers2

0

I just want to know why can't I use fopen?

Because JavaScript isn't C.

More generally, there's no way for arbitrary web pages to run arbitrary native code on your computer because otherwise clicking a link could take you to a page that would steal every file on your computer and then erase your hard drive.

smorgan
  • 20,228
  • 3
  • 47
  • 55
0

If you use firebreath then you're in C++, so you can use fopen if you wish. Keep in mind that you would have the same privileges as the browser, which running as a user probably can't write places like Program Files, etc.

You can't use fopen in javascript. I don't know why a "building firebreath on linux" page would ever have snippets on how to open a file; since firebreath is just C++ I don't know why we'd need to add docs for opening a file at all.. it's just C++. Open a file like you would in any other C++ application.

The other question has all the information you need to figure out where your file is; they didn't include specifics on how to do the operation itself because you don't need those specifics; you can get them anywhere. Try googling "open a file in c++" and you'll get lots of hits.

taxilian
  • 14,229
  • 4
  • 34
  • 73
  • i know how to open a file in c++ i just don't like c++ - i know french i just don't like to speak french - see? anyway what you are suggesting is to create a c++ file that opens the file and compile the project? that easy? that simple? there are hundreds of files in firebreath and hundred of docs... – Lynob Mar 02 '12 at 19:54
  • i'm starting to understand what flashgot did, but not 100% sure! they created a jar file, which would open the downloader, created a simple api that they will call when you click on a link.... I'm gonna try and do the same thing, firefox does not care what your extension has as long as it does not have to deal with it, i believe i can do the same with chrome, one python file to do the stuff, and a simple api, use xml to do the stuff.... 2 or 3 files, instead of hundreds...let me try :) – Lynob Mar 02 '12 at 19:59
  • your question reads "How to open a fire in FireBreath" I have answered that question. If you want to ask a different question, please create a different question. On an unrelated note, java can be used but will pop up a dialog verifying that the user wants to allow access to the drive. However, that's a completely *completely* different question from the one you ask. For new questions, create a new question. – taxilian Mar 02 '12 at 20:19
  • no i respect everything you and your team have done to create firebreath, i really do but did you read [this docs](http://www.firebreath.org/display/documentation/Creating+a+New+Plugin+Project#CreatingaNewPluginProject-Whatjusthappened) `Arguably the most important file in the project to get right, this is where 90% of the configuration happens. Nearly all of the things you were prompted for by fbgen.py go directly into this file. Don't worry – you can change it if you want to. Configuration options from this file are used to generate other files that are critical to your plugin configuration` – Lynob Mar 02 '12 at 20:31
  • and you say i need to create a separate c++, so 'm just confused! so confused! like a lot lol :D so i don't work there? i just create a c++ file and compile? and what about the js in my extension? how to communicate between the files? – Lynob Mar 02 '12 at 20:35
  • 1
    You ask about using FireBreath; FireBreath is C++. If you don't want to use FireBreath (and thus dont' want to use C++), don't ask about C++. You could possibly do it another way, such as with java, but you ask about using FireBreath, so I answered with how FireBreath would do it. Regarding your quote of the docs, talking about PluginConfig.cmake; that is metadata. It has no bearing on this discussion that I can find. It has nothing to do with creating a file. – taxilian Mar 02 '12 at 21:15