日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Firefox 扩展开发 install.rdf和chrome.manifest

發布時間:2025/7/14 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Firefox 扩展开发 install.rdf和chrome.manifest 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
現在我們以一個hello world擴展為例來說明Firefox 擴展的基本運行方式。先下載 Hello World extension,解壓縮,下面假定路徑是c:\helloworld.
設置firefox擴展代理文件

Firefox 擴展包實際上就是一個zip壓縮文件,顯然開發時每做一點改動都重新打包安裝會很麻煩。firefox提供了一種代理機制,可以把文件夾作為一個擴展。編輯擴展包中的文件helloworld@mozilla.doslash.org,把內容改為c:\helloworld,復制到配置dev\extensions,運行firefox,會出現提示,安裝了新擴展的,但不兼容新版本(如果你用的是2.0以后版本)。

install.rdf
現在我們來看install.rdf文件:

<?xml version="1.0"?> <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <Description about="urn:mozilla:install-manifest"> <em:id>helloworld@mozilla.doslash.org</em:id> <em:name>Hello World (Firefox 1.5 edition)</em:name> <em:version>1.0</em:version> <em:description>Classic first extension from MozillaZine KB</em:description> <em:creator>Nickolay Ponomarev</em:creator> <!-- optional items --> <em:contributor>A person who helped you</em:contributor> <em:contributor>Another one</em:contributor> <em:homepageURL>http://kb.mozillazine.org/Getting_started_with_extension_development</em:homepageURL> <!--em: optionsURL>chrome://sampleext/content/settings.xul</em: optionsURL> <em:aboutURL>chrome://sampleext/content/about.xul</em:aboutURL> <em:iconURL>chrome://sampleext/skin/mainicon.png</em:iconURL> <em:updateURL>http://sampleextension.mozdev.org/update.rdf</em:updateURL--> <!-- Firefox --> <em:targetApplication> <Description> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minVersion>1.5</em:minVersion> <em:maxVersion>3.5.*</em:maxVersion> </Description> </em:targetApplication> </Description> </RDF>
  • helloworld@mozilla.doslash.org,擴展的ID,email格式,但不應該是你實際的email,擴展代理文件用作文件名。
  • em:minVersion,em:maxVersion,兼容的firefox最小和最大版本。

修改em:maxVersion為合適值,重新安裝擴展,菜單->工具項會多出了一項紅色“Hello World!",點擊會彈出一個新窗口。

chrome.manifest

Chrome 指的是應用程序窗口的內容區域之外的用戶界面元素的集合,這些用戶界面元素包括工具條,菜單,進度條和窗口的標題欄等。Chrome 提供者能為特定的窗口類型(如瀏覽器窗口)提供 chrome。有三種基本的 chrome 提供者:

* 內容(Content):通常是 XUL 文件。
* 區域(Locale) :存放本地化信息。
* 皮膚(Skin):描述 chrome 的外觀。通常包含 CSS 和圖像文件。
firefox通過Chrome URIs來存取這些文件,比如chrome://browser/content/browser.xul是瀏覽器的主界面,在地址欄輸入這個URL試試。

文件chrome.manifest用來注冊Chrome包和物理地址的對應關系,簡單的說明:

content helloworld content/

這句定義了helloworld包的content的實際位置為content/目錄,最后的斜線是必須的

overlay chrome://browser/content/browser.xul chrome://helloworld/content/overlay.xul

覆蓋(overlay):這句把overlay.xul合并到browser.xul上。

locale helloworld en-US locale/en-US/

英語

skin helloworld classic/1.0 skin/

皮膚

style chrome://global/content/customizeToolbar.xul chrome://helloworld/skin/


轉載于:https://www.cnblogs.com/memaxiaofeng/archive/2013/04/02/3275502.html

總結

以上是生活随笔為你收集整理的Firefox 扩展开发 install.rdf和chrome.manifest的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。