Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In case of XUL/Firefox, what you need is the nsIIOService interface, which you can get like this:</p> <pre><code>var mIOS = Components.classes["@mozilla.org/network/io-service;1"]. getService(Components.interfaces.nsIIOService); </code></pre> <p>Then you need to create a channel, and open an asynchronous link:</p> <pre><code>var channel = mIOS.newChannel(urlToOpen, 0, null); channel.asyncOpen(new StreamListener(), channel); </code></pre> <p>The key here is the <code>StreamListener</code> object:</p> <pre><code>var StreamListener = function() { return { QueryInterface: function(aIID) { if (aIID.equals(Components.interfaces.nsIStreamListener) || aIID.equals(Components.interfaces.nsISupportsWeakReference) || aIID.equals(Components.interfaces.nsISupports)) return this; throw Components.results.NS_NOINTERFACE; onStartRequest: function(aRequest, aContext) { return 0; }, onStopRequest: function(aRequest, aChannel /* aContext */, aStatusCode) { return 9; }, onDataAvailable: function(aRequest, aContext, aStream, aOffset, aCount) { return 0; } }; } </code></pre> <p>You have to fill in the details in the <code>onStartRequest</code>, <code>onStopRequest</code>, <code>onDataAvailable</code> functions, but that should be enough to get you going. You can have a look at how I used this interface in my Firefox extension (it is called IdentFavIcon, and it can be found on the mozilla add-ons site).</p> <p>The part which I'm uncertain about is how you can trigger this page request from time to time, <code>set_timeout()</code> should probably work, though.</p> <p><strong>Edit:</strong></p> <ol> <li>See example <a href="https://developer.mozilla.org/en/Code_snippets/Downloading_Files" rel="nofollow noreferrer">here</a> (see section <em>Downloading Images</em>) for an example on how to collect downloaded data into a single variable; and</li> <li>See <a href="https://developer.mozilla.org/en/Code_snippets/HTML_to_DOM" rel="nofollow noreferrer">this page</a> on how to convert an HTML source into a DOM tree.</li> </ol> <p>HTH.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload