Home  »  appAPI

appAPI

Tags:  

This page has moved. To view the new content, please Click Here.


appAPI Overview

The appAPI object is at the heart of Crossrider' solution that enables you to write cross-browser extensions that run on all the major browsers. The API methods can be used in the following scopes:

  • Page Code: Code written in this scope (extension.js) of your extension is run every time a page (tab) is loaded (DOM ready) and can be considered as part of the loaded page. Therefore, in addition to using appAPI methods in this scope, you can use JavaScript and jQuery in the the normal manner to interact with the page's DOM.
  • Background Code: Code written in this scope (background.js) of your extension is run once in the browser's background when it starts, and persists for the lifetime of your extension. In this scope you can use appAPI methods and JavaScript to manage background processes such as handling browser buttons, fetching data, managing timers, etc.

You can easily communicate between the background code and the page code using the Messaging API.

Note: Some API methods can only be used in the scope of background code (e.g. Browser Action).

This section describes the following API features:
Ready
[Page only]
Defines where the execution code starts. Place your extension's page code in this method
DB Synchronously saves data to Crossrider's local database (db)
Async DB Asynchronously saves data to Crossrider's local database (db)
Cross Domain Request Enables an extension to talk to remote servers outside of its origin
HTTP Requests
[Background only]
Adds an event handler that is called when an HTTP request is triggered, such as when either a page, or resources (images, scripts, ...) on a page, are requested
Messaging API Enables communication between components of an extension
Resources API Enables you use external files (e.g. .js, .css, .png, ...) located in your project's Resources repository in your extension
Google Analytics Enables you to send tracking data to your Google Analytics account
DOM Helper Provides a convenient collection of methods to help you work with the DOM object of the current page
Browser Action
[Background only]
Configures the tooltip, badge, icon, and onClick event handler
Context Menus
[Background only]
Enables you to add one or more commands to the context menus that appear when you right-click on elements within a page
App Info Provides information about the extension that is currently running
Time Helper Provides a collection of methods to help you create date objects relative to the current date and time
JSON Provides a collection of methods to help you serialize (stringify) JS values and deserialize (parse) JSON strings
Selected Text Detects text selection and handles the selected text using a callback function
Keyboard Shortcuts Provides a collection of methods to help you work with keyboard shortcuts
Match Pages Returns true if the URL of the current page matches one or more of the specified patterns
Open URL Opens a URL, bypassing any popup blockers
Get Tab Id Returns the id of the current tab





 RSS of this page

Written by:   Version:   Last Edited By:   Modified