xul

Scope of JavaScript variables (XUL-related)

允我心安 提交于 2020-01-03 02:50:10
问题 A beginner's question, probably a trivial one. Here's the XUL code snippet: <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/javascript" src="chrome://.../main.js"/> <button label="Click me!" oncommand="clickhandler()"/> </window> The JavaScript code: // main.js var test = "Peanut butter"; // a global variable function clickhandler() { alert(test); } The interpreter processes the JavaScript file just after reading the main window's

Open XUL in a new tab/window using Addon-SDK

纵饮孤独 提交于 2020-01-02 07:14:24
问题 It seems possible according to https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/XUL_Migration_Guide: you can register a chrome: URI, with a skin and locale, and this means you can include XUL windows in an SDK-based add-on. I added a chrome.manifest as instructed with content: content my_addon content/ and put .xul file under chrome/content: myxul.xul then I use tabs.open in main.js: tabs.open("chrome://my_addon/content/myxul.xul"); It returns "File not found" as the new tab is opened:

In a Firefox extension, how can I copy rich text/links to the clipboard?

限于喜欢 提交于 2020-01-01 07:16:05
问题 Specifically, I want to copy a link (with text and location) and then to be able to paste it, e.g., into Word as a link. 回答1: dig around inside Download of the Day: AutoCopy Firefox extension or Clipboard-Save-As 1.0.4 回答2: Here's the actual code: var richText = "<a href=\"" + gContextMenu.linkURL + "\">" + gContextMenu.linkText() + "</a>"; var xfer = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable); xfer.addDataFlavor("text/html")

Reading web-page cookies from a Firefox extension (XUL)

ぃ、小莉子 提交于 2020-01-01 06:53:03
问题 I'm creating an extension for the Firefox browser. I would like to read a cookie which was set by an HTML page using JavaScript in the XUL file. Is it possible? I tried using document.cookie , but it doesn't work: function readCookie(name) { var ca = document.cookie.split(';'); var nameEQ = name + "="; for(var i=0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);

Reading web-page cookies from a Firefox extension (XUL)

你。 提交于 2020-01-01 06:52:34
问题 I'm creating an extension for the Firefox browser. I would like to read a cookie which was set by an HTML page using JavaScript in the XUL file. Is it possible? I tried using document.cookie , but it doesn't work: function readCookie(name) { var ca = document.cookie.split(';'); var nameEQ = name + "="; for(var i=0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);

setting xulrunner browser preferences

自作多情 提交于 2019-12-25 16:56:21
问题 I am using a xulrunner-1.9.2.12.en-US.win32 for an app I am creating. I want the user to be able to change the colours of the app using something similar to the "tools, options, content, colors" menu in firefox. I am using a prefwindow to set browser.display.background_color using a colour picker. If I look at chrome://global/content/config.xul I see that the value for this property has been correctly changed, however, I see no corresponding change in the web page look and feel. If I view

Load multiple pages in a hidden iframe from a xul-based firefox extension

拈花ヽ惹草 提交于 2019-12-25 10:01:15
问题 From a xul-based firefox addon, I need to: programmatically create an invisible iframe (once) reuse it to load multiple URLs as the addon runs access the returned HTML after each URL loads Problem: I can only get the first page-load for any created iframe to trigger an 'onload' or 'DOMContentLoaded' event. For subsequent URLs, there is no event triggered. Note: I'm also fine with using the hiddenDOMWindow itself if this is possible... Code: var urls = ['http://en.wikipedia.org/wiki/Internet',

Load multiple pages in a hidden iframe from a xul-based firefox extension

无人久伴 提交于 2019-12-25 10:01:12
问题 From a xul-based firefox addon, I need to: programmatically create an invisible iframe (once) reuse it to load multiple URLs as the addon runs access the returned HTML after each URL loads Problem: I can only get the first page-load for any created iframe to trigger an 'onload' or 'DOMContentLoaded' event. For subsequent URLs, there is no event triggered. Note: I'm also fine with using the hiddenDOMWindow itself if this is possible... Code: var urls = ['http://en.wikipedia.org/wiki/Internet',

Passing values to iframe inside xul panel

末鹿安然 提交于 2019-12-25 08:58:15
问题 I am creating a firefox extension that has a button on the toolbar that will show below custom content that i will set. I was using a XUL file to create the structure of this content, and i was opening it like this: var config = { confirm: false , username:"", password:""}; window.openDialog( "chrome://myext/content/login.xul", "", "centerscreen=no,all=no,titlebar=no,chrome=yes, toolbar=no,dialog=no,resizable=no,modal=yes", config); Now i'm taking another approach, by using an iframe inside a

Dispatch CustomEvent() to prefwindow - Firefox addon

帅比萌擦擦* 提交于 2019-12-25 06:31:43
问题 Working with a Firefox addon, I wish to send a CustomEvent() to a preference window. I open the preference window using an openDialog(), and keep a reference to the opened window. After that, I try to dispatch the event, but the event is never received. var pWin = window.openDialg("chrome://myextension/path/options.xul", "name", features); var event = new pWin.CustomEvent("prefwindow-event"); pWin.dispatchEvent(event); In the prefwindow scope, I have this code in the XUL attached script :