Mobile/Fennec/CodeSnippets: Difference between revisions

Jump to navigation Jump to search
m
Line 14: Line 14:
</pre>
</pre>


== Access the Browser ==
== Access the Browser ==Fennec has several JavaScript objects you should use to access the browser and the browser UI. The main objects are <code>Browser</code> and <code>Tab</code>. They have the following APIs:<pre>Browser------- property browsers   gets an array of all XUL browsers. property selectedBrowser   gets the currently active XUL browser. function getTabAtIndex(index)   returns Tab or null. function getTabFromContent(content)   returns Tab or null. function addTab(uri, bringFront)   creates a new Tab with the given URI. returns the new Tab. function closeTab(tab)   closes the given Tab. property selectedTab   sets/gets the selected Tab.Tab------ property browser   gets the XUL browser for the Tab. property content   gets the XUL element holding the Tab thumbnail. function isLoading()   returns whether the Tab is busy loading content.</pre>
Fennec has several JavaScript objects you should use to access the browser and the browser UI. The main objects are <code>Browser</code> and <code>Tab</code>. They have the following APIs:
 
<pre>
Browser
-------
  property browsers
    gets an array of all XUL browsers.
 
  property selectedBrowser
    gets the currently active XUL browser.
 
  function getTabAtIndex(index)
    returns Tab or null.
 
  function getTabFromContent(content)
    returns Tab or null.
 
  function addTab(uri, bringFront)
    creates a new Tab with the given URI. returns the new Tab.
 
  function closeTab(tab)
    closes the given Tab.
 
  property selectedTab
    sets/gets the selected Tab.
 
Tab
------
  property browser
    gets the XUL browser for the Tab.
 
  property content
    gets the XUL element holding the Tab thumbnail.
 
  function isLoading()
    returns whether the Tab is busy loading content.
</pre>


== Listening for Browser Events ==
== Listening for Browser Events ==
2

edits

Navigation menu