0

I have created a plugin using firebreath its been installed in firefox but i wanted to know is it possible to load the plugin automatically when i open a file with

.XXX

extension ? example: you can right click on a PDF and open with browser and it opens the PDF in npapi plugin. How it is possible? and how PDF maintains same UI for all browsers and they dont expose their code its embedded. Do they use HTML 5 canvas? as far as i searched there are very less information about it.

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
Navin
  • 554
  • 2
  • 9
  • 31

1 Answers1

2

You can register plugins for file extensions (although you can't override built-in support that way): set(FBSTRING_FileExtents "XXX")

Plugins can be opened in the two relevant modes: embedded as an element in the page or as full-page - e.g. when you navigate to http://foo.com/bar.pdf or request a document who's mimetype your plugin handles. The Acrobat Reader plugin is most often seen as a full-page plugin and rarely actually embedded somewhere.

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
  • Thanks, but how PDF provides interface (with tool bar and all) inside browser. It is not pure HTML using canvas. What is it and how have they done it ? and what do u mean by "can't override built-in support"? – Navin Sep 11 '13 at 12:10
  • 1
    Well, for example you can't override the browser handling `.html` files. The UI is all drawn in the plugins window or drawable area, no HTML or JS involved here. I'm not sure what Adobe does given that it's available cross-platform, they might implement & draw their own thing here. But for e.g. a plain Windows plugin you could just use native controls. – Georg Fritzsche Sep 11 '13 at 12:28
  • this is where i am paused, you said UI is drawn in the plugins window or drawable area. How is it possible to draw. can we run a cocoa webkit inside firefox browser using plugins? do u have any tutorial link where i can learn about UI in plugins. – Navin Sep 11 '13 at 16:21
  • 1
    http://colonelpanic.net/2010/11/firebreath-tips-drawing-on-windows/ for info on windows, http://www.firebreath.org/display/documentation/Event+models+and+drawing+models for info on mac. Also see the BasicMediaPlayer example in the firebreath source tree for example of drawing on mac – taxilian Sep 11 '13 at 16:30
  • @taxilian Thanks , is it possible to integrate a webkit inside a browser... i want to draw using HTML n JS. anyways the links are very useful. – Navin Sep 11 '13 at 16:36
  • 1
    There is a very experimental example of doing this in the firebreath source tree under src/libs/WebView. It works for some things, not for others, and involves a lot of hacks, but you're welcome to try it. It is not supported by anyone or anything. – taxilian Sep 11 '13 at 16:41
  • 1
    @Navin Note that a WebView is about the heaviest solution for this (perf and memory wise). If you can, consider other options. – Georg Fritzsche Sep 11 '13 at 21:08
  • @GeorgFritzsche thanks, i am planning to do it in my own way rather than experimenting how PDF has done it. and i guess i probably need to call plugin from my extension to do this. – Navin Sep 19 '13 at 17:11